import sys from collections import deque sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N,M = MI() board = [[-1]*N for _ in range(N)] board[0][0] = 1 board[-1][-1] = 1 directions = [(-1,0),(1,0),(0,-1),(0,1)] deq = deque([(0,0)]) while deq: i,j = deq.pop() for di,dj in directions: ni,nj = i+di,j+dj if not (0 <= ni < N and 0 <= nj < N): continue if ni == nj == N-1: print('Yes',flush=True) exit() if board[ni][nj] != -1: continue print(ni+1,nj+1,flush=True) T = S() if T == 'Black': board[ni][nj] = 1 deq.append((ni,nj)) else: board[ni][nj] = 0