import java.util.ArrayDeque; import java.util.Queue; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] dx = {1, 0, -1, 0}; int[] dy = {0, 1, 0, -1}; int[][] d = new int[n][n]; d[0][0] = 1; d[n - 1][n - 1] = 1; Queue que = new ArrayDeque<>(); que.add(0); while (!que.isEmpty()) { int cur = que.poll(); int cx = cur / n; int cy = cur % n; for (int i = 0; i < 4; i++) { int nx = cx + dx[i]; int ny = cy + dy[i]; if (nx < 0 || n <= nx || ny < 0 || n <= ny) { continue; } if (nx == n - 1 && ny == n - 1) { System.out.println("Yes"); return; } if (d[nx][ny] == 0) { System.out.println((nx + 1) + " " + (ny + 1)); String t = sc.next(); if (t.equals("-1")) { return; } else if (t.equals("Black")) { d[nx][ny] = 1; que.add(nx * n + ny); } else { d[nx][ny] = 2; } } } } System.out.println("No"); } }