N, M = map(int, input().split()) D = [(-1, 0), (1, 0), (0, -1), (0, 1)] Grid = [[0] * (N + 1) for _ in range(N + 1)] Grid[1][1] = 1 Query = [(1, 1)] while Query: H, W = Query.pop() print(H, W) Judge = input() if Judge == 'Black': for d1, d2 in D: h, w = H + d1, W + d2 if h == N and w == N: print('Yes') exit() if h >= 1 and h <= N and w >= 1 and w <= N and not Grid[h][w]: Query.append((h, w)) Grid[h][w] = 1 elif Judge == '-1': exit() print('No')