#include #include using namespace std; int N, M; bool used[1009][1009], shirabeta[1009][1009]; int dx[4] = { 1, 0, -1, 0 }; int dy[4] = { 0, 1, 0,-1 }; queue> Q; int main() { cin >> N >> M; used[1][1] = true; shirabeta[1][1] = true; Q.push(make_pair(1, 1)); while (!Q.empty()) { int px = Q.front().first, py = Q.front().second; Q.pop(); for (int i = 0; i < 4; i++) { int ex = px + dx[i], ey = py + dy[i]; if (ex <= 0 || ex > N || ey <= 0 || ey > N) continue; if (shirabeta[ex][ey] == true) continue; cout << ex << " " << ey << endl; string str; cin >> str; if (str == "Black") { used[ex][ey] = true; Q.push(make_pair(ex, ey)); } shirabeta[ex][ey] = true; } } if (used[N][N] == true) cout << "Yes" << endl; else cout << "No" << endl; return 0; }