mod = 1000000007 eps = 10**-9 def main(): import sys from heapq import heappush, heappop input = sys.stdin.readline def ask(h, w): print(h, w) sys.stdout.flush() return input().rstrip('\n') N, M = map(int, input().split()) H = W = N Q = 3000 pq = [] heappush(pq, (N*2-3, 1)) heappush(pq, (N*2-3, W)) seen = [[0] * N for _ in range(N)] d = [(0, 1), (0, -1), (1, 0), (-1, 0)] M -= 2 while Q: _, hw = heappop(pq) h, w = divmod(hw, N) if seen[h][w]: continue T = ask(h+1, w+1) Q -= 1 if T == -1: exit() elif T == "Black": M -= 1 for dh, dw in d: h_new, w_new = h+dh, w+dw if 0 <= h_new < H and 0 <= w_new < W: if h_new == H-1 and w_new == W-1: print("Yes") exit() p = H-1 - h_new + W-1 - w_new if p - 1 <= M: heappush(pq, (H-1 - h_new + W-1 - w_new, h_new*W+w_new)) print("No") if __name__ == '__main__': main()