#include #include #define pb push_back #define mp make_pair using namespace std; typedef pair coord; deque DQ; int n = 200; int main(){ DQ.push_back(make_pair(0,0)); while (!DQ.empty()){ coord pred = DQ.front(); DQ.pop_front(); int i = pred.first, j = pred.second; cout << i << " " << j << "\n"; cout.flush(); int rez; cin >> rez; if (rez == 0) return 0; else{ if (i + 1 < n and j < n){ cout << i + 1 << " " << j << "\n"; cout.flush(); int rezd; cin >> rezd; if (rezd == 0) return 0; if (rez < 0 and rezd >= rez) DQ.push_back(make_pair(i+1,j)); if (rez > 0 and rezd <= rez) DQ.push_back(make_pair(i+1,j)); } if (i < n and j + 1 < n) { cout << i << " " << j + 1 << "\n"; cout.flush(); int rezr; cin >> rezr; if (rezr == 0) return 0; if (rez < 0 and rezr >= rez) DQ.push_back(make_pair(i,j+1)); if (rez > 0 and rezr <= rez) DQ.push_back(make_pair(i,j+1)); } } } return 0; }