#include<bits/stdc++.h>
using namespace std;
const int MAX = 100+10;
int n, xa, ya, xb, yb;
char g[MAX][MAX];
int d[4][2] = {-1, 0, 1, 0, 0, -1, 0, 1};
bool v[MAX][MAX];
bool dfs(int x, int y){
if(x==xb && y==yb) return true;
v[x][y] = true;
for(int i=0; i<4; i++){
int xx = x+d[i][0], yy = y+d[i][1];
if(xx<0 || xx>=n || yy<0 || yy>=n) continue;
if(v[xx][yy]) continue;
if(g[xx][yy]=='#') continue;
if(dfs(xx, yy)) return true;;
}
return false;
}
int main(){
int t;
scanf("%d", &t);
while(t--){
scanf("%d", &n);
for(int i=0; i<n; i++) scanf("%s", g[i]);
scanf("%d%d%d%d", &xa, &ya, &xb, &yb);
memset(v, false, sizeof v);
if(g[xa][ya]!='#' && g[xb][yb]!='#' && dfs(xa, ya)) puts("YES");
else puts("NO");
}
return 0;
}