import sys x = 0 y = 0 altitude = 10000 xlim = 200 ylim = 200 xlast = True ylast = True while altitude != 0: sys.stdout.flush() sys.stdout.write(str(x) + " " + str(y) + "\n") line = sys.stdin.readline() 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