def main(): N=int(input()) A=list(map(int,input().split())) def f(): t=0 for i in A: t^=i c=0 m=-1 d=0 while t>0: if (t&1): m=c d+=(1<>=1 for i in range(len(A)): if (A[i]>>m)&1 and A[i]>=d: A[i]-=d return [i+1,d] s=0 for i in A: s^=i if s!=0: print(1,flush=True) print(*f(),flush=True) r=int(input()) if r==-1: return else: print(0,flush=True) while 1: a,b=map(int,input().split()) A[a-1]-=b r=int(input()) if r==-1: return print(*f(),flush=True) r=int(input()) if r==-1: return return main()