The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K to form a new pattern. Help the chef to code this pattern problem.

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, one integer $K$. 

-----Output:-----
For each test case, output as the pattern.

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq K \leq 100$

-----Sample Input:-----
5
1
2
3
4
5

-----Sample Output:-----
1
1
32
1
32
654
1
32
654
10987
1
32
654
10987
1514131211

-----EXPLANATION:-----
No need, else pattern can be decode easily.

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(n):
		for j in range(n):
			if i >= j:
				print(int((i + 1) * (i + 2) / 2) - j, end='')
		print()


t = int(input())
for i in range(0, t):
	n = int(input().strip())
	val = 1
	for xyz in range(1, n + 1):
		list1 = list()
		for abc in range(1, xyz + 1):
			list1.append(val)
			val += 1
		print(*list1[::-1], sep='')
		print()
		list1.clear()


t = int(input())
while t != 0:
	s = ''
	k = int(input())
	for i in range(1, k + 1):
		for j in range(i * (i + 1) // 2, i * (i - 1) // 2, -1):
			s = s + str(j)
		print(s)
		s = ''
	t -= 1


for a0 in range(int(input())):
	n = int(input())
	l = []
	for j in range(1, (n ** 2 + n) // 2 + 1):
		l.append(str(j))
	for i in range(n):
		s = ''
		x = l[:i + 1]
		x = x[::-1]
		for p in x:
			s += p
		print(s)
		l = l[i + 1:]


for i in range(int(input())):
	p = int(input())
	k = 1
	print(1, end='')
	print()
	s = 0
	for i in range(1, p):
		k += i + 1
		x = k
		for j in range(i + 1):
			print(x, end='')
			x -= 1
		print()


for u in range(int(input().strip())):
	n = int(input().strip())
	k = 1
	for i in range(1, n + 1):
		l = list()
		for j in range(1, i + 1):
			l.append(k)
			k += 1
		print(*l[::-1], sep='')
		print()
		l.clear()


t = int(input())
while t:
	n = int(input())
	k = 1
	for i in range(n):
		m = k + i
		for j in range(i + 1):
			print(m - j, end='')
			k += 1
		print()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(1)
		continue
	ctr = 1
	lis = []
	temp = 1
	for i in range(n):
		for j in range(temp):
			lis.append(ctr)
			ctr += 1
		temp += 1
		lis.reverse()
		lis = list(map(str, lis))
		print(''.join(lis))
		lis = []


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = []
	s = n * (n + 1) // 2
	for i in range(1, n + 1):
		s = i * (i + 1) // 2
		for j in range(i):
			print(s, end='')
			s -= 1
		print()


for i in range(int(input())):
	n = int(input())
	val = 0
	for i in range(1, n + 1):
		st = ''
		temp = val + i
		val = temp
		for j in range(i):
			print(temp, end='')
			temp -= 1
		print()


from sys import *
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	num = 1
	diff = 1
	for i in range(n):
		y = num
		for j in range(i + 1):
			print(y, end='')
			y -= 1
		diff = diff + 1
		num += diff
		print()


for _ in range(int(input())):
	n = int(input())
	t = 0
	for i in range(1, n + 1):
		j = 0
		k = t + i
		while j < i:
			print(k, end='')
			t += 1
			j += 1
			k -= 1
		print('')


n = int(input())
for i in range(n):
	a = int(input())
	k = 0
	for j in range(1, a + 1):
		k = k + j
		for l in range(k, k - j, -1):
			print(l, end='')
		print()


for _ in range(int(input())):
	n = int(input())
	l = 1
	i = 1
	while l <= n:
		s = ''
		for j in range(l):
			s = str(i) + s
			i += 1
		print(s)
		l += 1


t = int(input())
for i in range(t):
	k = int(input())
	m = 0
	for j in range(1, k + 1):
		m = m + j
		n = m
		for l in range(1, j + 1):
			print(n, end='')
			n = n - 1
		print()


for tc in range(int(input())):
	K = int(input())
	k = 1
	for i in range(K):
		ar = []
		for j in range(i + 1):
			ar.append(str(k))
			k += 1
		print(''.join(ar[::-1]))


T = int(input())
for t in range(T):
	N = int(input())
	num = 1
	for i in range(N):
		sol = ''
		for j in range(i + 1):
			sol = str(num) + sol
			num += 1
		print(sol)


t = int(input())
for i in range(t):
	k = int(input())
	a = 1
	for i in range(1, k + 1):
		b = a + i
		l = []
		for x in range(a, b):
			l.append(x)
		for y in l[::-1]:
			print(y, end='')
		print()
		a = b


t = int(input())
for _ in range(t):
	n = int(input())
	c = 0
	for i in range(n):
		ans = ''
		c += i + 1
		for j in range(i + 1):
			ans += str(c)
			c -= 1
		c += i + 1
		print(ans)


for _ in range(int(input())):
	n = int(input())
	p = 0
	for i in range(n):
		p += i + 1
		for j in range(p, p - i - 1, -1):
			print(j, end='')
		print()


for _ in range(int(input())):
	n = int(input())
	j = 1
	for i in range(n):
		s = ''
		l = []
		for j in range(j, j + i + 1):
			l.append(str(j))
		j += 1
		print(''.join(l[::-1]))