#include using namespace std; using lli = long long; #define rep(i,n) for(int i=0;ibool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b ostream &operator<<(ostream &os, const vector &x){ os << "{"; for(size_t i = 0; i < x.size(); i++){ if(i < x.size()-1) os << x[i] << ", "; else os << x[i]; } os << "}"; return os; } const int di[] = {0, 0, -1, 1}; const int dj[] = {-1, 1, 0, 0}; int main(void){ int n, m; cin >> n >> m; vector> g(n, vector(n, -1)); g[0][0] = g[n-1][n-1] = 0; function query = [&](int x, int y){ if(g[x][y] != -1) return g[x][y]; string res; cout << (x+1) << " " << (y+1) << endl; cin >> res; if(res == "-1") return -1; else if(res == "Black") return g[x][y] = 0; else if(res == "White") return g[x][y] = 1; return -1; }; vector seen(n*n); function dfs = [&](int x){ if(x == n*n-1) return true; if(seen[x]) return false; seen[x] = true; int i = x/n; int j = x%n; int c = query(i, j); if(c == 1 || c == -1) return false; rep(k, 4){ int ni = i+di[k]; int nj = j+dj[k]; if(ni < 0 || nj < 0 || ni >= n || nj >= n) continue; int nx = ni*n+nj; if(dfs(nx)){ return true; } } return false; }; bool f = dfs(0); if(f) cout << "Yes" << endl; else cout << "No" << endl; return 0; }