import sys numbers = map(str,range(1,10)) N = ["0"]*4 for i in xrange(4): print " ".join(N) sys.stdout.flush() X,Y = map(int,raw_input().split()) if X == 4: quit() for j in numbers: N[i] = j print " ".join(N) sys.stdout.flush() x,y = map(int,raw_input().split()) if x == 4: quit() if x > X: break else: N[i] = "0" print " ".join(N) sys.stdout.flush()