#include using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP(i, n) for (int i = (int)(n); i >= 0; i--) #define rep(i, a, n) for (int i = (a); i < (int)(n); i++) #define rrep(i, a, n) for (int i = (a); i >= (int)(n); i--) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() using ll = long long; using vi = vector; using vii = vector>; using P = pair; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; int N, M; vector> seen, masu; queue

Q; int main() { cin >> N >> M; seen.assign(N+1,vector(N+1)); masu.assign(N+1,vector(N+1)); Q.push({1,1}); seen[1][1] = true; masu[1][1] = true; while(Q.size()) { int px, py; tie(px, py) = Q.front(); Q.pop(); REP(i,4) { int ex = px + dx[i], ey = py + dy[i]; if(ex <= 0 || ey <= 0 || ex > N || ey > N) continue; if(seen[ex][ey]) continue; cout << ex << " " << ey << endl; string nxt; cin >> nxt; if(nxt == "Black") { masu[ex][ey] = true; Q.push({ex,ey}); } seen[ex][ey] = true; } } cout << (masu[N][N] ? "Yes" : "No") << endl; return 0; }