#include using namespace std; using ll = long long; int a[502][502]; int main() { int n, m; cin >> n >> m; for (int i = 0; i <= n + 1; i++) { for (int j = 0; j <= n + 1; j++) { a[i][j] = -1; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { a[i][j] = 0; } } a[1][1] = 1; a[n][n] = 1; queue> q; q.push({ 1, 1 }); while (!q.empty()) { auto p = q.front(); q.pop(); pair d[4] = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } }; for (int k = 0; k < 4; k++) { auto t = p; t.first += d[k].first; t.second += d[k].second; if (t.first == n && t.second == n) { cout << "Yes" << endl; exit(0); } int x = a[t.first][t.second]; if (x != 0) continue; cout << t.first << ' ' << t.second << endl; string s; cin >> s; a[t.first][t.second] = s[0] == 'B' ? 1 : 2; if (a[t.first][t.second] == 1) { q.push(t); } } } cout << "No" << endl; return 0; }