from collections import deque import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) DX = (-1, 0, 1, 0, -1, -1, 1, 1) DY = (0, 1, 0, -1, -1, 1, -1, 1) DX = DX[:4] DY = DY[:4] H, W = map(int, input().split()) A, sx, sy = map(int, input().split()) B, gx, gy = map(int, input().split()) sx += 1 sy += 1 gx += 1 gy += 1 G = [[0] * (W + 2) for _ in range(H + 2)] for i in range(1, H + 1): for j, x in enumerate(input().rstrip(), 1): if x == "*": G[i][j] = 1 else: G[i][j] = -1 U = 1000 + 50 * 50 dist = [[[-1] * (U + 1) for _ in range(W + 2)] for _ in range(H + 2)] dist[sx][sy][A] = 0 que = deque([(sx, sy, A)]) while que: x, y, a = que.popleft() d = dist[x][y][a] for dx, dy in zip(DX, DY): nx = x + dx ny = y + dy if G[x][y] == 1 and a < U and dist[nx][ny][a + 1] == -1: dist[nx][ny][a + 1] = d + 1 que.append((nx, ny, a + 1)) if G[x][y] == -1 and a and dist[nx][ny][a - 1] == -1: dist[nx][ny][a - 1] = d + 1 que.append((nx, ny, a - 1)) if dist[gx][gy][B] == -1: print("No") else: print("Yes")