from collections import * from itertools import * from functools import * from heapq import * import sys, math input = sys.stdin.readline H,W = map(int,input().split()) A,sx,sy = map(int,input().split()) B,gx,gy = map(int,input().split()) M = [list(input())[:-1] for _ in range(H)] vis = defaultdict(lambda:False) vis[(sx,sy,A)] = True v = deque() v.append((sx,sy,A)) def nb(x,y): tmp = [] if x+1=0: tmp.append((x-1,y)) if y+1=0: tmp.append((x,y-1)) return tmp while v: x,y,h = v.popleft() if h>1300: continue for ix,iy in nb(x,y): if M[ix][iy]=='.': if h==1: continue if vis[(ix,iy,h-1)]: continue vis[(ix,iy,h-1)]=True v.append((ix,iy,h-1)) else: if vis[(ix,iy,h+1)]: continue vis[(ix,iy,h+1)]=True v.append((ix,iy,h+1)) if vis[(gx,gy,B)]: print('Yes') else: print('No')