#include <bits/stdc++.h>
using namespace std;
int k, n, ha, la, hb, lb;
string ans;
string mg[105];
bool vis[105][105];
int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
void dfs(int x, int y)
{
if (x == hb && y == lb)
{
ans = "YES\n";
return;
}
for (int i = 0; i < 4; i++)
{
int xx = x + dir[i][0];
int yy = y + dir[i][1];
if (xx >= 0 && xx < n && yy >= 0 && yy < n && !vis[xx][yy] && mg[xx][yy] != '#')
{
vis[xx][yy] = true;
dfs(xx, yy);
// vis[xx][yy]=false;
}
}
}
int main()
{
cin >> k;
while (k--)
{
cin >> n;
for (int i = 0; i < n; i++)
cin >> mg[i];
cin >> ha >> la >> hb >> lb;
ans = "NO\n";
vis[ha][la] = true;
dfs(ha, la);
cout << ans;
memset(vis, 0, sizeof(vis));
}
return 0;
}