from collections import * H, W = map(int, input().split()) A, sx, sy = map(int, input().split()) B, gx, gy = map(int, input().split()) G = [] for i in range(H): G.append(list(input())) Q = deque() Q.append((sx, sy, A)) dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] M = 1200 S = set() S.add((sx, sy, A)) while Q: px, py, c = Q.popleft() for k in range(4): x = px + dx[k] y = py + dy[k] if x < 0 or x > H - 1 or y < 0 or y > W - 1: continue if G[x][y] == "*": nc = c + 1 else: nc = c - 1 if nc < 0 or nc >= M: continue if (x, y, nc) in S: continue S.add((x, y, nc)) Q.append((x, y, nc)) if B == nc and x == gx and y == gy: print("Yes") exit() print("No")