import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) directions = [(1, 0), (0, 1), (0, -1), (-1, 0)] used = [[False] * n for _ in range(n)] def dfs(i, j): global m for di, dj in directions: ni = i + di nj = j + dj if ni == -1 or nj == -1 or ni == n or nj == n: continue if used[ni][nj]: continue if nj == n - 1 and nj == n - 1: print("Yes") exit() used[ni][nj] = True print(ni + 1, nj + 1, flush = True) t = input() if t == "-1": exit() elif t == "Black": dfs(ni, nj) else: m -= 1 if m == 0: print("No") exit() used[0][0] = True used[-1][-1] = True dfs(0, 0) print("No")