#include using namespace std; using point = pair; enum { unknown = 0, black = 1, white = 2, }; vector dx{1, 0, -1, 0}, dy{0, 1, 0, -1}; int main() { int n, m; cin >> n >> m; vector color(n, vector(n, unknown)); color.at(0).at(0) = black; queue q; q.emplace(0, 0); while (not q.empty()) { auto [x, y] = q.front(); q.pop(); for (int i = 0; i < 4; i++) { int x_next = x + dx.at(i), y_next = y + dy.at(i); if (x_next < 0 or n <= x_next or y_next < 0 or n <= y_next) { continue; } if (color.at(x_next).at(y_next) != unknown) { continue; } if (x_next == n - 1 and y_next == n - 1) { cout << "Yes" << endl; return 0; } cout << x_next + 1 << ' ' << y_next + 1 << endl; string res; cin >> res; if (res == "Black") { color.at(x_next).at(y_next) = black; q.emplace(x_next, y_next); } else if (res == "White") { color.at(x_next).at(y_next) = white; } else { return 0; } } } cout << "No" << endl; return 0; }