ANS=[-1,-1,-1,-1] for ind in range(4): L=[] for i in range(5): A=[6,7,8,9] A[ind]=i print(*A,flush=True) x,y=map(int,input().split()) if x==4 and y==0: exit() else: L.append(x) if len(set(L))==5: pass else: MAX=max(L) k=L.index(MAX) ANS[ind]=k continue L=[] for i in range(5,10): A=[0,1,2,3] A[ind]=i print(*A,flush=True) x,y=map(int,input().split()) if x==4 and y==0: exit() else: L.append(x) if len(set(L))==5: pass else: MAX=max(L) k=L.index(MAX) ANS[ind]=k+5 continue print(*ANS,flush=True) x,y=map(int,input().split())