#include <iostream>
#include <cstring>
using namespace std;
const int N = 110;
char g[N][N]; int sx, sy, fx, fy, n;
int read() {
int f = 0, x = 0; char c = getchar();
for (; !isdigit(c); c = getchar()) f = (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
return f ? -x : x;
}
bool dfs(int x, int y)
{
g[x][y] = '#';
if(x == fx && y == fy) return true ;
int dx[] = {1, 0, -1, 0},
dy[] = {0, 1, 0, -1};
for (int i = 0; i < 4; i ++ )
{
int nx = x + dx[i], ny = y + dy[i];
if(nx < 1 || nx > n || ny < 1 || ny > n) continue ;
if(g[nx][ny] == '#') continue ;
if(dfs(nx, ny)) return true ;
}
return false;
}
int main()
{
int T = read();
while (T -- )
{
n = read();
for (int i = 1; i <= n; i ++ )
for (int j = 1; j <= n; j ++ )
scanf(" %c", &g[i][j]);
scanf("%d%d%d%d", &sx, &sy, &fx, &fy);
sx ++, sy ++, fx ++, fy ++ ;
if (g[sx][sy] == '#' || g[fx][fy] == '#')
{
puts ("NO");
continue;
}
puts(dfs(sx, sy) ? "YES" : "NO");
}
return 0;
}