#include #include #include using namespace std; const int NMAX = 200; int n, m; int val[NMAX][NMAX]; bool in_q[NMAX][NMAX]; queue < pair > q; void solve() { pair p; p.first = p.second = 0; q.push(p); while(!q.empty()) { p = q.front(); n = p.first; m = p.second; q.pop(); cout << n << ' ' << m; cout << '\n'; cout.flush(); cin >> val[n][m]; if (val[n][m] == 0) { return; } if (val[n][m] < 0) { if (n + 1 < NMAX) { p.first = n + 1; p.second = m; q.push(p); in_q[n + 1][m] = true; } if (m + 1 < NMAX) { p.first = n; p.second = m + 1; q.push(p); in_q[n][m + 1] = true; } } } } int main() { solve(); return 0; }