import sys def solve assume_one zero assume_one for in range zero for

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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