import heapq def main(): import sys input = sys.stdin.read data = input().split() idx = 0 H = int(data[idx]); idx += 1 W = int(data[idx]); idx += 1 Y = int(data[idx]) - 1; idx += 1 # convert to 0-based X = int(data[idx]) - 1; idx += 1 grid = [] for i in range(H): row = list(map(int, data[idx:idx+W])) grid.append(row) idx += W heap = [] visited = [[False for _ in range(W)] for _ in range(H)] directions = [(-1, 0), (1, 0), (0, -1), (0, 1)] current_attack = grid[Y][X] visited[Y][X] = True # Push initial adjacent cells for dx, dy in directions: nx = Y + dx ny = X + dy if 0 <= nx < H and 0 <= ny < W: a = grid[nx][ny] heapq.heappush(heap, (a, nx, ny)) count = 0 total_enemies = H * W - 1 while heap: a, i, j = heapq.heappop(heap) if visited[i][j]: continue if a > current_attack: continue visited[i][j] = True current_attack += a count += 1 if count == total_enemies: break for dx, dy in directions: ni = i + dx nj = j + dy if 0 <= ni < H and 0 <= nj < W: if not visited[ni][nj]: heapq.heappush(heap, (grid[ni][nj], ni, nj)) if count == total_enemies: print("Yes") else: print("No") if __name__ == "__main__": main()