from collections import deque N, M = map(int, input().split()) grid = [[None]*N for _ in range(N)] grid[0][0] = True grid[-1][-1] = True M -= 2 q = deque() q.append((0, 0)) move = [(-1, 0), (1, 0), (0, 1), (0, -1)] def ques(y, x): print(x+1, y+1) s = input() if s == 'Black': return True else: return False flag = False qs = 0 while q and M: y, x = q.popleft() for dy, dx in move: ny, nx = dy+y, dx+x if 0 <= ny < N and 0 <= nx < N and grid[nx][ny] is None: if nx == ny == N-1: flag = True q = deque() break if ques(ny, nx): grid[ny][nx] = True q.append((ny, nx)) qs += 1 if qs == 3000: q = deque() break M -= 1 else: grid[ny][nx] = False if flag: print('Yes') else: print('No')