#include using namespace std; typedef long long ll; #define F first #define S second #define pii pair #define eb emplace_back #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < n; ++i) #define rep3(i, l, n) for (int i = l; i < n; ++i) #define chmax(a, b) a = (a >= b ? a : b) #define chmin(a, b) a = (a <= b ? a : b) #define out(a) cout << a << endl #define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl #define SZ(v) (int)v.size() #define inf (int)(1e9+7) #define abs(x) (x >= 0 ? x : -(x)) int calc(int x, int y) { return abs(x - 100000) + abs(y - 50000); } int main() { ios::sync_with_stdio(false); cin.tie(0); map mp; int x = 0, y = 0; int m; while (1) { cout << x << " " << y << endl; cin >> m; // m = calc(x, y); if (m == 0) break; rep(i, 100001) { int b = m - abs(x - i); if (b < 0 || b > 100000) continue; vector v; int j = y - b; if (j >= 0 && j <= 100000) v.eb(j); int j2 = y + b; if (j2 >= 0 && j2 <= 100000 && j != j2) v.eb(j2); rep(j, SZ(v)) { if (x == 0 && y == 0) { mp[{i, v[j]}]++; } else { if (mp[{i, v[j]}] == 1) mp[{i, v[j]}]++; } } } if (!(x == 0 && y == 0)) { for (auto e : mp) { if (e.S == 1) mp[{e.F.F, e.F.S}] = 0; else if (e.S == 2) mp[{e.F.F, e.F.S}] = 1; // out(e.F.F << " " << e.F.S << " " << e.S); } } for (auto e : mp) { if (e.S == 0) continue; // out(e.F.F << " " << e.F.S << " " << e.S); x = e.F.F; y = e.F.S; break; } } }