a =[0, 0, 0, 0] b = a[:] c = a[:] n = 0 f = 1 for i in range(10): print(i, i, i, i) x, y = map(int, input().split()) if x > 3 : f = 0 break if x + y < 1: b=[i, i, i, i] break a = b[:] while f: a[n] = (a[n]+1)%10 print(a[0], a[1], a[2], a[3]) x, y = map(int, input().split()) if x > 0: c[n] = a[n] n += 1 a = b[:] if n > 3: print(c[0], c[1], c[2], c[3]) break