from collections import deque N,M = list(map(int,input().split())) dy = [-1,1,0,0] dx = [0,0,-1,1] q = deque([(0,0)]) grid = [[-1 for _ in range(N)] for _ in range(N)] while(q): y,x = q.popleft() if(y == N-1 and x == N-1): print("Yes") exit() if(grid[y][x] != -1):continue if not (y == 0 and x == 0): print(y+1,x+1) bw = input() grid[y][x] = 1 if bw == "Black" else 0 for i in range(4): next_y = y + dy[i] next_x = x + dx[i] if(next_y < 0 or N <= next_y):continue if(next_x < 0 or N <= next_x):continue if(grid[next_y][next_x] == 0):continue q.append((next_y,next_x)) print("No")