#include #define rep(i, l, r) for (int i = (l); i < (r); i++) using namespace std; typedef long long ll; int main() { int N, M, dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; string T; cin >> N >> M; vector> c(N, vector(N, -1)); queue> q; q.push(make_pair(0, 0)); c[0][0] = 1; while (!q.empty()) { auto p = q.front(); q.pop(); int x = p.first, y = p.second; rep(i, 0, 4) { int nx = x + dx[i], ny = y + dy[i]; if (nx == N - 1 && ny == N - 1) { cout << "Yes" << endl; return 0; } if (nx < 0 || nx >= N || ny < 0 || ny >= N) continue; if (c[nx][ny] != -1) continue; cout << nx + 1 << " " << ny + 1 << endl; cin >> T; if (T == "-1") return 0; if (T == "Black") { c[nx][ny] = 1; q.push(make_pair(nx, ny)); } else { c[nx][ny] = 0; } } } cout << "No" << endl; }