import sys
def solve(a, assume_one):
r = [0] * 7
a = [0] + a
zero = a[1] - assume_one
for i in range(7):
a[i] -= zero
for i in range(1, 7):
if a[i] < 0:
return None
r[i] = a[i]
t = i
el = r[i] * 2
while True:
t += 1
if t % i == 0:
el *= 2
if t < 7:
a[t] -= (el - r[i])
else:
break
if sum(r) != zero:
return None
return r[1:]
tc, _ = map(int, input().split(' '))
for tnum in range(tc):
d = []
for ind1 in range(6):
print(ind1+1)
sys.stdout.flush()
te = input()
if te == '-1':
break
else:
d.append(int(te))
if len(d) != 6:
break
for i in range(101):
res = solve(d, i)
if res is not None:
break
print(' '.join([str(x) for x in res]))
sys.stdout.flush()
te = input()
if te == '-1':
break