# please, use python v3.2
import os
import io
import random
import math

random.seed(23723572325)
testNo = 0

def generate(n):
	a = [i for i in range(n + 1)]
	result = 1
	for i in range(2, n + 1):
		result *= a[i]
		for j in range(2 * i, n + 1, i):
			a[j] //= a[i]
	return result

def printTest(n):
	global testNo
	testNo += 1
	if not (os.path.exists('../tests')):
		os.mkdir('../tests')
	test = open('../tests/%02d' % testNo, 'w')
	test.write(str(n) + '\n')
	test.close()

# sample tests
printTest(5)
printTest(8)

# small tests
for k in range(0, 21):
	if k != 5 and k != 8:
		printTest(k)

printTest(23)
printTest(42)

# big tests
for i in range(10):
	printTest(10**9 - i)

# some prime numbers
for p in [239, 1543, 84307, 104729, 237434723, 8388607, 536870911]:
	printTest(p)

# some random numbers
for i in range(10):
	printTest(random.randint(0, 10**9))

# n!
for n in range(4, 13):
	printTest(math.factorial(n) - 1)
	
last = -1	
for n in range(4, 43):
	cur = generate(n)
	if cur > 10**9:
		break
	if cur == last:
		continue	
	printTest(cur - 1)	
	last = cur

# n^2 - 1
sq = int(math.sqrt(10**9))
for i in range(10):
	x = random.randint(sq // 2, sq)
	printTest(x * x - 1)