#include #include #include using namespace std; const int NMAX = 200; int v[NMAX+2][NMAX+2]; int N = NMAX; bool Found = 0; void TRY( int a, int b, int x, int y ) { if( a > x ) return; if( b > y ) return; if( Found ) return; int n = (a + x) / 2; int m = (b + y) / 2; if( v[n][m] ) return; v[n][m] = 1; cout << n << ' ' << m << '\n'; int val; cin >> val; cout.flush(); if( val == 0 ) { Found = 1; return ; } if( val > 0 ) { TRY( a, b, n, m ); TRY( n, b, x, m-1 ); TRY( a, m, n-1, y ); } if( val < 0 ) { TRY( a, m+1, n, y ); TRY( n, m, x, y ); TRY( n+1, b, x, m ); } } int main() { TRY( 0, 0, NMAX-1, NMAX-1 ); return 0; }