from random import *
from sys import argv

seed('ololo')

test = 0
def out(a):
	global test
	test += 1
	print('%d'%test)
	out = open('../tests/%02d'%test, 'w')
	print(len(a[0]), file = out)
	print(" ".join(str(x) for x in a[0]), file = out)
	print(" ".join(str(x) for x in a[1]), file = out)

def out_preliminary(a, b):
	global test
	test += 1
	print('%d'%test)
	out = open('../preliminary/%02d'%test, 'w')
	print(len(a), file = out)
	print(" ".join(str(x) for x in a), file = out)
	print(" ".join(str(x) for x in b), file = out)
	
def negative(n, k):
	res = [[], []]
	for i in range(n):
		res[0].append(randint(0, k - 1))
		res[1].append(res[0][i] + randint(1, k - res[0][i]))
	
	shuffle(res)
	
	return res
	
def positive(n, k):
	res = [[], []]
	t = 0
	for i in range(n):
		res[t].append(randint(0, k - k // 2))
		res[1 - t].append(res[t][i] + randint(randint(0, 1), k - res[t][i]))
		t = 1 - t
		
	shuffle(res)
	
	return res
	
#sample test
out_preliminary([3, 4, 5], [1, 6, 2])
out_preliminary([3, 6, 5], [1, 4, 2])		
out_preliminary([1, 4], [3, 2])		
test = 0 
#min tests
out(positive(10, 10))
out(negative(10, 100))
out(positive(50, 200))
out(positive(70, 350))
out(negative(100, 500))
out(positive(100, 500))

#max_tests
out(negative(1000, 700))
out(positive(1000, 500))
out(negative(10000, 1000))
out(positive(10000, 1000))

for i in [21, 22, 23, 24, 25, 40, 55, 70, 85, 100]:
	out(([randint(0, 1000) for i in range(i)], [randint(0, 1000) for i in range(i)]))


