import sys n = [] for i in range(10): print(i,i,i,i) sys.stdout.flush() x,y = map(int,input().split()) if x >= 1: for j in range(x): n.append(i) for i in range(4): for j in range(4): if i != j: for k in range(4): if i != k and j != k: for l in range(4): if i != l and j != l and k != l: print(n[i],n[j],n[k],n[l]) sys.stdout.flush() x,y = map(int,input().split()) if x == 4 and y == 0: sys.exit(0)