def guesser(max_number):
fh = open("guesser.log","w")
bottom = 0
top = max_number
res = 1
while res != 0:
guess = int((bottom + top) / 2)
print(guess)
sys.stdout.flush()
fh.write(str(guess) + " ")
res = int(input())
if res == -1: # number is higher
bottom = guess
elif res == 1:
top = guess
elif res == 0:
message = "Wanted number is %d" % guess
fh.write(message)
else: # this case shouldn't occur
print("input not correct")