import sys from collections import deque n,m = map(int,input().split()) count = 0 q = deque([(1,0),(0,1)]) black = [[-1]*n for i in range(n)] black[0][0] = black[-1][-1] = 1 while q and count < 3000: x,y = q.popleft() print(x+1,y+1) sys.stdout.flush() s = input() if s == "Black": black[x][y] = 1 for dx,dy in ((0,1),(1,0),(0,-1),(-1,0)): nx = x+dx ny = y+dy if nx == ny == n-1: print("Yes") exit() if 0 <= nx < n and 0 <= ny < n and black[nx][ny] == -1: q.append((nx,ny)) else: black[x][y] = 0 count += 1 print("No")