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, cnt): cnt[0] += 1 print(x+1, y+1) s = input() if s == 'Black': return True else: return False flag = False cnt = [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[ny][nx] is None: if nx == ny == N-1: flag = True q = deque() break if ques(ny, nx): grid[ny][nx] = True q.append((ny, nx)) M -= 1 else: grid[ny][nx] = False if cnt[0] == 3000: q = deque() break if flag: print('Yes') else: print('No')