import random
import sys
T = 20

allnumbers = range(1000001)

print T
for t in xrange(T):
	print
	N = random.randint(1, 100000)
	cornell = [random.randint(1, 1000000) for i in xrange(N)]
	if random.random() < .5: # Make them equal
		print >> sys.stderr, 'equal'
		random.shuffle(allnumbers)
		white = [allnumbers[i] for i in cornell]
	else:
		print >> sys.stderr, 'different'
		white = [random.randint(1, 1000000) for i in xrange(N)]
	random.shuffle(white)
	random.shuffle(cornell)
	print N
	print ' '.join([str(i) for i in cornell])
	print ' '.join([str(i) for i in white])
