#include<bits/stdc++.h>
using namespace std;
const int N=1e1+10;
int n;
char c[N][N];
int ha,la,hb,lb;
int ans;
int q[]={-1,0,1,0},w[]={0,1,0,-1},vis[N][N];
void dfs(int x,int y,int sum){
if(x==hb and y==lb){
ans=1;
return;
}
for(int i=0;i<4;i++){
int nx=x+q[i],ny=y+w[i];
if(nx>=0 and nx<n and ny>=0 and ny<n and c[nx][ny]!='#' and vis[nx][ny]==0){
vis[nx][ny]=1;
dfs(nx,ny,sum+1);
vis[nx][ny]=0;
}
}
}
int main(){
int k;
cin>>k;
for(int i=1;i<=k;i++){
cin>>n;
for(int j=0;j<n;j++){
for(int l=0;l<n;l++){
cin>>c[j][l];
}
}
cin>>ha>>la>>hb>>lb;
dfs(ha,la,0);
if(ans==1) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
for(int j=0;j<n;j++){
for(int l=0;l<n;l++){
c[j][l]=0;
vis[j][l]=0;
}
}
}
return 0;
}