#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int b[550][550] = { 0 }; int b1[4] = { 0,0,1,-1 }; int b2[4] = { 1,-1,0,0 }; int main() { long long n, m; cin >> n >> m; queue> que; que.push(make_pair(1, 1)); b[1][1] = 1; while (!que.empty()) { int x = que.front().first, y = que.front().second; que.pop(); for (int j = 0; j < 4; j++) { if (x + b1[j] == n && y + b2[j] == n) { cout << "Yes" << endl; return 0; } if (x + b1[j] <= 0 || x + b1[j] > n || y + b2[j] <= 0 || y + b2[j] > n)continue; if (b[x + b1[j]][y + b2[j]] == 0) { cout << x + b1[j] << " " << y + b2[j] << endl; string s; cin >> s; if (s == "-1") { return 0; } else if (s == "Black") { b[x + b1[j]][y + b2[j]] = 1; que.push(make_pair(x + b1[j], y + b2[j])); } else { b[x + b1[j]][y + b2[j]] = -1; } } } } cout << "No" << endl; return 0; }