dxy = zip([1, 0, -1, 0], [0, 1, 0, -1]) H, W = map(int, raw_input().split()) A, Sy, Sx = map(int, raw_input().split()) B, Gy, Gx = map(int, raw_input().split()) M = [raw_input() for i in xrange(H)] que = [(A, Sx, Sy)] used = set() while que: a, x, y = que.pop(0) if (a, x, y) in used: continue used.add((a, x, y)) if Gx == x and Gy == y and a == B: print "Yes" break for dx, dy in dxy: nx, ny = x + dx, y + dy if 0 <= nx < W and 0 <= ny < H: na = a + (1 if M[ny][nx] == "*" else -1) if na <= 0 or na >= 1100: continue if (na, nx, ny) in used: continue que.append((na, nx, ny)) else: print "No"