#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int N = 110;
int n;
char g[N][N];
bool visit[N][N];
int x1, y1, x2, y2;
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
bool dfs(int x1, int y1)
{
if (g[x1][y1] == '#') return false;
if (x1 == x2 && y1 == y2) return true;
visit[x1][y1] = true;
for (int i = 0; i < 4; ++ i)
{
int x = x1 + dx[i], y = y1 + dy[i];
if (x < 0 || x >= n || y < 0 || y >= n || visit[x][y]) continue;
if (dfs(x, y)) return true;
}
return false;
}
int main()
{
int k;
cin >> k;
while (k --)
{
cin >> n;
for (int i = 0; i < n; ++ i)
cin >> g[i];
memset(visit, 0, sizeof(visit));
scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
if (dfs(x1, y1)) printf("YES\n");
else printf("NO\n");
}
return 0;
}