#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = long long; using uint = unsigned; using ull = unsigned long long; using namespace std; template constexpr T INF = ::numeric_limits::max() / 32 * 15 + 208; template vector make_v(U size, const T& init){ return vector(static_cast(size), init); } template auto make_v(U size, Ts... rest) { return vector(static_cast(size), make_v(rest...)); } template void chmin(T &a, const T &b){ a = (a < b ? a : b); } template void chmax(T &a, const T &b){ a = (a > b ? a : b); } template struct REC { F f; REC(F &&f_) : f(std::forward(f_)) {} template auto operator()(Args &&... args) const { return f(*this, std::forward(args)...); } }; int main() { int n, k; cin >> n >> k; auto query = [&](int a, int b){ cout << a+1 << " " << b+1 << endl; string s; cin >> s; if(s == "-1") exit(0); if(s == "Black") return 1; else return 0; }; int p = 3000; auto dp = make_v(n, n, -1); dp[0][0] = dp[n-1][n-1] = 1; array dy{-1, 1, 0, 0}, dx{0, 0, -1, 1}; REC([&](auto &&f, int x, int y) -> int { for (int dir = 0; dir < 4; ++dir) { int xx = x+dx[dir], yy = y+dy[dir]; if(xx == n-1 && yy == n-1){ cout << "Yes" << endl; exit(0); } if(p && 0 <= xx && xx < n && 0 <= yy && yy < n && !~dp[xx][yy]){ dp[xx][yy] = query(xx, yy); p--; if(dp[xx][yy]) { f(xx, yy); } } } return 0; })(0, 0); cout << "No" << endl; return 0; }