Read problems statements in mandarin chinese, russian and vietnamese as well. 

This year CodeChef is organizing the SnackUp cooking contest. The favorite to win is of course our beautiful Chef Ada.

There are n judges in the contest, and for simplicity let's enumerate judges from 1 to n. 

Ada has an uncountable repertoire of delicious recipes, but for the contest she choose only n of them. Let's also enumerate the recipes from 1 to n.

Ada is going to show off her cooking skills in many rounds, and we are going to help her organizing them! One round is structured as follows:
We will choose k distinct recipes and Ada will prepare two identical dishes for each of them.
We will choose k distinct judges for the round.
We will send k invitation letters (one for each of the chosen judges). Each letter must contain the number of the judge, and two distinct integers denoting the ids of the recipes that he is going to taste. 
Two different judges can taste the same recipe, but it must be from different dishes. 
Ada does not like to waste food, so the letters must be designed in such a way that every prepared dish is tasted.

You can arbitrarily decide the number of rounds and the number of invited judges in each round, but as a rule of the contest at the end of all rounds each judge must have tasted every recipe exactly twice.

------ Input ------ 

The first line of input contains one number T, the number of test cases.
Each test case consist of one line containing an integer n, the number of judges.

------ Output ------ 

For each testcase, in the first line, print r the number of rounds, then describe each round as follows.

In the first line of each round, print k, the number of invited judges.
In the next k lines, print the invitation letters as three space separated integers: j, x, y denoting the id of the judge, and the ids of the recipe that he is going to taste. Note that x should not be equal to y.

------ Constraints ------ 

1 ≤ T ≤ 100
2 ≤ n ≤ 100

----- Sample Input 1 ------ 
1
2
----- Sample Output 1 ------ 
2
2
1 1 2
2 1 2
2
1 1 2
2 1 2

Difficulty: MEDIUM_HARD

Solutions:
def soln(n):
	arr = [(i, i + 1) for i in range(1, n)]
	arr.append((1, n))
	print(n)
	for i in range(n):
		print(n)
		for j in range(n):
			print(j + 1, *arr[(i + j) % n])
for _ in range(int(input())):
	n = int(input())
	soln(n)


testcase = int(input())
for _ in range(testcase):
	numberOFJudges = int(input())
	numberOFRounds = numberOFJudges
	print(numberOFRounds)
	IDofRecipe_1 = 1
	IDofRecipe_2 = 2
	for i in range(numberOFRounds - 1):
		print(numberOFJudges)
		for IDofJudges in range(numberOFJudges):
			print(IDofJudges + 1, IDofRecipe_1, IDofRecipe_2)
		IDofRecipe_1 = IDofRecipe_1 + 1
		IDofRecipe_2 = IDofRecipe_2 + 1
	print(numberOFJudges)
	for IDofJudges in range(numberOFJudges):
		print(IDofJudges + 1, 1, numberOFJudges)


for _ in range(int(input())):
	n = int(input())
	print(n)
	x = 1
	y = 2
	for i in range(n - 1):
		print(n)
		for j in range(n):
			print(j + 1, x, y)
		x += 1
		y += 1
	print(n)
	for i in range(n):
		print(i + 1, 1, n)


def solve():
	print(n)
	(x, y) = (1, 2)
	for r in range(n - 1):
		print(n)
		for j in range(1, n + 1):
			print(j, x, y)
		x += 1
		y += 1
	print(n)
	for j in range(1, n + 1):
		print(j, 1, n)
t = int(input())
for _ in range(t):
	n = int(input())
	solve()


def rotate(arr):
	temp = arr[-1]
	new_temp1 = arr[1]
	for i in range(1, len(arr), 2):
		if i + 2 <= len(arr):
			new_temp2 = arr[i + 2]
			arr[i + 2] = new_temp1
			new_temp1 = new_temp2
	arr[1] = temp
for t in range(int(input())):
	n = int(input())
	arr = []
	print(n)
	for i in range(n):
		arr.append(i + 1)
		arr.append('j' + str(i + 1))
	for k in range(n):
		print(n)
		for i in range(n):
			j = i + 1
			index = arr.index('j' + str(j))
			if index + 1 < len(arr):
				print(i + 1, arr[index - 1], arr[index + 1])
			else:
				print(i + 1, arr[0], arr[index - 1])
		rotate(arr)


for t in range(int(input())):
	n = int(input())
	rounds = 2 * n // 2
	print(rounds)
	c = 1
	d = 2
	for j in range(rounds):
		print(n)
		for i in range(1, n + 1):
			print(i, c, d)
		c = (c + 1) % n + 1
		d = (d + 1) % n + 1


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n)
		for i in range(n // 2):
			for j in range(2):
				print(n)
				l = [(i, i + 1) for i in range(1, n, 2)]
				ln = len(l)
				c = i
				for k in range(1, n + 1, 2):
					print(k, l[c][0], l[c][1])
					print(k + 1, l[c][0], l[c][1])
					if c == ln - 1:
						c = 0
						for nt in range(k + 2, n + 1, 2):
							print(nt, l[c][0], l[c][1])
							print(nt + 1, l[c][0], l[c][1])
							c += 1
						break
					c += 1
	else:
		print(n)
		l = [(i, i + 1) for i in range(1, n)]
		l.append((n, 1))
		ln = len(l)
		for i in range(n):
			print(n)
			c = i
			for k in range(1, n + 1):
				print(k, l[c][0], l[c][1])
				if c == ln - 1:
					c = 0
					for nt in range(k + 1, n + 1):
						print(nt, l[c][0], l[c][1])
						c += 1
					break
				c += 1


for _ in range(int(input())):
	n = int(input())
	if n & 1:
		print(n - 3 + 3)
		for x in range(1, n - 3, 2):
			for t in range(2):
				print(n)
				for j in range(n):
					print(j + 1, x, x + 1)
		print(n)
		for j in range(n):
			print(j + 1, n - 2, n - 1)
		print(n)
		for j in range(n):
			print(j + 1, n - 2, n)
		print(n)
		for j in range(n):
			print(j + 1, n - 1, n)
	else:
		print(n)
		for x in range(1, n, 2):
			for t in range(2):
				print(n)
				for j in range(n):
					print(j + 1, x, x + 1)


T = int(input())
for t in range(T):
	temp = 0
	dishes = []
	n = int(input())
	for i in range(2):
		for x in range(n):
			dishes.append(x + 1)
	rounds = n
	print(rounds)
	for Round in range(1, n + 1):
		print(n)
		i = temp
		for judge in range(1, n + 1):
			if i >= len(dishes):
				i = 0
			print(judge, end='')
			print(' %d %d' % (dishes[i], dishes[i + 1]))
			i += 2
		temp += 2


t = int(input())
for _ in range(t):
	judges = int(input())
	(start, end) = (1, 2)
	print(judges)
	for i in range(judges - 1):
		print(judges)
		for j in range(judges):
			print(j + 1, start, end)
		start += 1
		end += 1
	print(judges)
	start = 1
	end -= 1
	for i in range(judges):
		print(i + 1, start, end)


t = int(input().strip())
for a0 in range(t):
	rounds = int(input().strip())
	print(rounds)
	judges = [None] * rounds
	arr = [j + 1 for j in range(rounds)] + [j + 1 for j in range(rounds)]
	for i in range(rounds):
		judges[i] = arr[2 * i:] + arr[:2 * i]
	for i in range(rounds):
		print(rounds)
		for j in range(rounds):
			print(j + 1, judges[j][2 * i], judges[j][2 * i + 1])