#================================================== def send(i,k): print(i,k, flush=True) def recieve(): i,k=map(int,input().split()) return i,k def phase(): return int(input()) def choice(turn): print(turn, flush=True) #================================================== def solve(): from collections import defaultdict N=int(input()) A=[0]+list(map(int,input().split())) grundy=0 for a in A[1:]: grundy^=a turn=1 if grundy else 0 choice(turn) while True: if turn: msb=1<<(grundy.bit_length()-1) for i in range(N+1): if msb&A[i]==msb: break h=grundy^A[i] k=A[i]-h send(i,k) else: i,k=recieve() grundy^=A[i]^(A[i]-k) A[i]-=k if phase()==-1: return turn^=1 #================================================== solve()