/*
bfs 自己写的过程中出现了不少问题
注意: 起点和终点可能是同一点
*/
#include <stdio.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include <iostream>
using namespace std;
#define N 110
char map[N][N];
bool vis[N][N];
int dir[4][2]={1,0, -1,0, 0,-1, 0,1};
struct point
{
int x,y;
int step;
};
int k,x1,y1,x2,y2;
int n,m;
bool check(int x,int y)
{
if(x>=1 && x<=m && y>=1 && y<=n && map[x][y]=='.' )
return 1;
return 0;
}
int bfs()
{
queue<point> q;
point start,cur;
start.x=x1;
start.y=y1;
start.step=-1;
vis[x1][y1]=1;
q.push(start); ////// 找了半天错误
while(!q.empty())
{
cur=q.front();
q.pop();
int x=cur.x;
int y=cur.y;
for(int i=0;i<4;i++)
{
int xx=x + dir[i][0];
int yy=y + dir[i][1];
while(check(xx,yy))
{
if(!vis[xx][yy])
{
start.x=xx;
start.y=yy;
start.step=cur.step+1;
q.push(start);
vis[xx][yy]=1;
if(xx==x2 && yy==y2 && start.step<=k)
{
return 1;
}
}
xx=xx + dir[i][0];
yy=yy + dir[i][1];
}
}
}
return 0;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&m,&n);
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
cin>>map[i][j];
// for( i=1;i<=m;i++)
// {
// for(int j=1;j<=n;j++)
// printf("%c",map[i][j]);
// printf("\n");
// }
scanf("%d%d%d%d%d",&k,&y1,&x1,&y2,&x2);
memset(vis,0,sizeof(vis));
if(x1==x2 && y1==y2)
{
printf("yes\n");
continue;
}
if(bfs())
printf("yes\n");
else
printf("no\n");
}
return 0;
}