#include #define REP(x,y,z) for(int x=y;x<=z;x++) #define FORD(x,y,z) for(int x=y;x>=z;x--) #define MSET(x,y) memset(x,y,sizeof(x)) #define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++) #define F first #define S second #define MP make_pair #define PB push_back #define SZ size() #define M 55 #define MT make_tuple void RI(){} template void RI( int& head, T&... tail ) { scanf("%d",&head); RI(tail...); } using namespace std; typedef long long LL; typedef tuple T; int n,m; int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1}; int sx,sy,sz; int ex,ey,ez; bool vis[M][M][3505]; char mp[M][M]; bool out(int x,int y) { return x<=0 || y<=0 || x>n || y>m; } int main() { int x,y,z; int nx,ny,nz; while(~scanf("%d %d",&n,&m)) { RI(sz,sx,sy); sx++; sy++; RI(ez,ex,ey); ex++; ey++; REP(i,1,n) scanf("%s", mp[i]+1); MSET(vis,false); queue q; vis[sx][sy][sz] = true; q.push(MT(sx,sy,sz)); while(!q.empty()) { tie(x,y,z) = q.front(); q.pop(); REP(i,0,3) { nx = x+dx[i]; ny = y+dy[i]; if(out(nx,ny)) continue; nz = z; if(mp[nx][ny]=='*') nz++; else nz--; if(nz<=0 || nz>3500) continue; if(vis[nx][ny][nz]) continue; vis[nx][ny][nz] = true; q.push(MT(nx,ny,nz)); } } puts(vis[ex][ey][ez] ? "Yes":"No"); } return 0; }