import itertools from collections import deque H, W = map(int, input().split()) A, Si, Sj = map(int, input().split()) B, Gi, Gj = map(int, input().split()) M = [input() for _ in range(H)] def point2int(h, w, x): """ H*W*1200の空間で探索 座標(h,w,x) →整数 1200*W*h+1200*w+x にエンコード """ return 1200 * W * h + 1200 * w + x Graph = [[] for _ in range(H * W * 1200)] for h, w in itertools.product(range(H), range(W)): n = (1 if M[h][w] == '*' else -1) # 入る辺 for dh, dw in [(1, 0), (0, 1), (-1, 0), (0, -1)]: if 0 <= h - dh < H and 0 <= w - dw < W: for x in range(1200): if 1 <= x - n < 1200: Graph[point2int(h - dh, w - dw, x - n)].append(point2int(h, w, x)) S = point2int(Si, Sj, A) G = point2int(Gi, Gj, B) # dfs d = deque([S]) visited = [False] * (H * W * 1200) while d: v = d.pop() if v == G: print('Yes') break visited[v] = True for x in Graph[v]: if not visited[x]: d.append(x) else: print('No')