import sys li = [0] * 4 while True: for i in range(4): max_x = 0 max_j = 0 for j in range(10): li[i] = j print(*li) sys.stdout.flush() x, y = map(int, input().split()) sys.stdout.flush() if (x, y) == (4, 0): exit() if x > max_x: max_x = x max_j = j li[i] = max_j