#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int a[2001][2001];

int request(int x, int y) {
    int aux;
    cout << x << ' ' << y << endl;
    cout.flush();
    cin >> aux;

    return aux;
};

int main() {

    int h=0,v=0, inch = 1, incv = 1;
    int response = request(0,0);
    a[0][0] = response;

    if (a[0][0] == 0) {
        return 0;
    }

    int newh = 0,newv = 0;
    while (1) {
        response = request(h+inch,v);
        if (response == 0) {
            return 0;
        }

        a[h+inch][v] = response;
        if (response < 0) {
            newh = min(199, h+inch);
            inch *= 2;
        } else {
            inch = 1;
            newh = h+1;
        }

        response = request(h,v+incv);
        if (response == 0) {
            return 0;
        }

        a[h][v+incv] = response;
        if (response < 0) {
            newv = min(199, v+incv);
            incv *= 2;
        } else {
            incv = 1;
            newv = v+1;
        }

        h = newh;
        v = newv;
    }

    return 0;
}