import sys N,M = map(int,input().split()) B = 'Black' W = 'White' q = [] masu = [[0] * (N+1) for _ in range(N+1)] masu[1][1] = 1 q.append((1,1)) while len(q): x,y = q.pop() if x == N and y == N: print('Yes') exit() for i,j in [[1,0],[-1,0],[0,1],[0,-1]]: if 1 <= x+i <= N and 1 <= y+j <= N: if masu[x+i][y+j] == 0: print(x+i,y+j) T = input() if T == B: masu[x+i][y+j] = 1 q.append((x+i,y+j)) else: masu[x+i][y+j] = -1 print('No')