using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ int Top=5000; bool[][][] M=new bool[Top][][]; for(int t=0;t Q=new Queue(); Q.Enqueue(enc(Si,Sj,A)); while(Q.Count>0){ var p=Q.Dequeue(); int x=decC(p); int y=decR(p); int vol=decV(p); for(int t=0;t<4;t++){ int nx=x+dx[t]; int ny=y+dy[t]; if(!InRange(nx,W)||!InRange(ny,H))continue; int nvol=vol; if(Map[ny][nx]=='*')nvol++; if(Map[ny][nx]=='.')nvol--; if(!InRange(nvol,Top))continue; if(!M[nvol][ny][nx]){ M[nvol][ny][nx]=true; Q.Enqueue(enc(ny,nx,nvol)); } } } Console.WriteLine(M[B][Gi][Gj]?"Yes":"No"); } static bool InRange(int t,int ul,int ll=0){ return (t=ll); } static int decR(int s){ return s&0xFF; } static int decC(int s){ return (s>>8)&0xFF; } static int decV(int s){ return s>>16; } static int enc(int r,int c,int v){ return r+(c<<8)+(v<<16); } int H,W; int A,Si,Sj; int B,Gi,Gj; String[] Map; public Sol(){ var d=ria(); H=d[0];W=d[1]; d=ria(); A=d[0];Si=d[1];Sj=d[2]; d=ria(); B=d[0];Gi=d[1];Gj=d[2]; Map=new String[H]; for(int i=0;iint.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} }