import sys

x = 0
y = 0
altitude = 10000
xlim = 10000
ylim = 10000

xlast = True
ylast = True

steps = 0


while steps < 200 and altitude != 0:
    sys.stdout.flush()
    sys.stdout.write(str(x) + " " + str(y) + "\n")
    line = sys.stdin.readline()
    if line is "Invalid Query":
        if xlast:
            xlim = x
        else:
            ylim = y
    else:
        altitude = int(line.strip())
        if altitude < 0:
            if x < xlim - 1:
                x = x + 1
                xlast = True
            else:
                y = y + 1
                ylast = True
        else:
            if altitude > 0:
                if x > 0:
                    x = x - 1
                    xlast = True
                else:
                    y = y - 1
                    ylast = True
            else:
                break
    steps += 1