#include #define rep(i, n) for (int i = 0; i < (n); ++i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) using namespace std; typedef long long int ll; typedef pair P; #define MAX_N 200005 const int dx[4] = {-1, 0, 1, 0}; const int dy[4] = {0, -1, 0, 1}; int main() { int n, m; cin >> n >> m; int a[n + 2][n + 2]; rep(i, n + 2) rep(j, n + 2) a[i][j] = 0; a[1][1] = 1; a[n][n] = 1; int f[n + 2][n + 2]; rep(i, n + 2) { rep(j, n + 2) { if (i == 0 || j == 0 || i == n + 1 || j == n + 1) f[i][j] = 1; else f[i][j] = 0; } } f[1][1] = 1; queue

que; que.push(P(1, 1)); int cnt = 0; while (que.size()) { int x = que.front().first; int y = que.front().second; que.pop(); rep(i, 4) { int nx = x + dx[i]; int ny = y + dy[i]; if (f[nx][ny]) continue; f[nx][ny] = 1; cout << nx << ' ' << ny << endl; fflush(stdout); string s; cin >> s; cnt++; if (s[0] == 'B') { a[nx][ny] = 1; que.push(P(nx, ny)); } if (cnt == 3000) break; } if (cnt == 3000) break; if (f[n][n]) break; } if (f[n][n]) { puts("Yes"); } else { puts("No"); } return 0; }