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)] cnt = [0] 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 while q: y, x = q.popleft() for dy, dx in move: ny, nx = dy+y, dx+x if nx == ny == N - 1: flag = True q = deque() break if 0 <= ny < N and 0 <= nx < N and grid[ny][nx] is None: if ques(ny, nx, cnt): grid[ny][nx] = True q.append((ny, nx)) else: grid[ny][nx] = False if cnt[0] == 3000: q = deque() break if flag: print('Yes') else: print('No')