#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() { bool done = false; n = m = 0; int top, left, right, bottom; top = left = 0; right = bottom = NMAX - 1; while(!done) { cout << n << ' ' << m; cout << '\n'; cout.flush(); cin >> val[n][m]; if (val[n][m] == 0) return; if (val[n][m] < 0) { top = max(top, n); left = max(left, m); n = min(n - val[n][m], bottom - 1); m = min(m - val[n][m], right - 1); } else { bottom = min(bottom, n); right = min(right, m); n = max(n - val[n][m], top + 1); m = max(m - val[n][m], left + 1); } } } int main() { solve(); return 0; }