from collections import deque def main(): import sys input = sys.stdin.read().split() ptr = 0 H = int(input[ptr]) ptr += 1 W = int(input[ptr]) ptr += 1 A = int(input[ptr]) ptr += 1 S_i = int(input[ptr]) ptr += 1 S_j = int(input[ptr]) ptr += 1 B = int(input[ptr]) ptr += 1 G_i = int(input[ptr]) ptr += 1 G_j = int(input[ptr]) ptr += 1 M = [] for _ in range(H): M.append(input[ptr].strip()) ptr += 1 max_possible_size = 6000 # Based on problem constraints and movement possibilities visited = [[[False] * (max_possible_size + 2) for _ in range(W)] for _ in range(H)] queue = deque() initial_size = A if initial_size <= max_possible_size and initial_size > 0: queue.append((S_i, S_j, initial_size)) visited[S_i][S_j][initial_size] = True directions = [(-1, 0), (1, 0), (0, -1), (0, 1)] found = False while queue: i, j, size = queue.popleft() for di, dj in directions: ni = i + di nj = j + dj if 0 <= ni < H and 0 <= nj < W: cell = M[ni][nj] if cell == '*': new_size = size + 1 else: new_size = size - 1 if new_size <= 0: continue if new_size > max_possible_size: continue if not visited[ni][nj][new_size]: visited[ni][nj][new_size] = True queue.append((ni, nj, new_size)) if ni == G_i and nj == G_j and new_size == B: found = True print("Yes") return print("No") if __name__ == "__main__": main()