h, w = list(map(int, input().split())) sy, sx, gy, gx = list(map(int, input().split())) b = [] for _ in range(h): b.append(input().strip()) f = [[True] * w for _ in range(h)] t = [[sy - 1, sx - 1]] f[sy - 1][sx - 1] = False while len(t) > 0: s = [] for y, x in t: if x > 0: if f[y][x - 1]: f[y][x - 1] = False s.append([y, x - 1]) if y > 0: if f[y - 1][x]: f[y - 1][x] = False s.append([y - 1, x]) if x < w - 1: if f[y][x + 1]: f[y][x + 1] = False s.appen([y, x + 1]) if y < h - 1: if f[y + 1][x]: f[y + 1][x] = False s.append([y + 1, x]) t = s if f[gy - 1][gx - 1] == False: break print('NO' if f[gy - 1][gx - 1] else 'YES')