import sys input = sys.stdin.readline H,W=map(int,input().split()) A,x,y=map(int,input().split()) B,z,w=map(int,input().split()) MAP=[input().strip() for i in range(H)] OK=[[[0]*W for i in range(H)] for j in range(2000)] OK[A][x][y]=1 Q=[(A,x,y)] while Q: now,x,y=Q.pop() for tx,ty in [(x+1,y),(x-1,y),(x,y+1),(x,y-1)]: if 0<=tx0 and OK[now-1][tx][ty]==0: OK[now-1][tx][ty]=1 Q.append((now-1,tx,ty)) else: if now+1<2000 and OK[now+1][tx][ty]==0: OK[now+1][tx][ty]=1 Q.append((now+1,tx,ty)) if OK[B][z][w]==1: print("Yes") else: print("No")