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:-----
2
2
4

-----Sample Output:-----
2
21
210
21
2
4
43
432
4321
43210
4321
432
43
4

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

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(n + 1):
		b = n
		for space in range(n - i):
			print(' ', end='')
		for j in range(i + 1):
			print(b, end='')
			b -= 1
		print()
	for l in range(n):
		a = n
		for j1 in range(0, l + 1):
			print(' ', end='')
		for k in range(n - l):
			print(a, end='')
			a -= 1
		print()


try:
	for test in range(int(input())):
		k = int(input())
		for i in range(k, 0, -1):
			for j in range(i):
				print(' ', end='')
			for j in range(k, i - 1, -1):
				print(j, end='')
			print()
		for i in range(k + 1):
			for j in range(i):
				print(' ', end='')
			for j in range(k, i - 1, -1):
				print(j, end='')
			print()
except:
	pass


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


t = int(input())
for _ in range(t):
	l = []
	n = int(input())
	for i in range(n + 1):
		x = ''
		for k in range(n - i):
			x += ' '
		for k in range(n, n - i - 1, -1):
			x += str(k)
		l.append(x)
	for i in range(len(l) - 2, -1, -1):
		l.append(l[i])
	for ele in l:
		print(ele)


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


t = int(input())
inputarr = []
for _ in range(t):
	a = int(input())
	inputarr.append(a)
final = []
for i in inputarr:
	for j in range(i + 1):
		n = list(range(i, i - j - 1, -1))
		s = ' ' * (i - j) + ''.join((str(elem) for elem in n))
		final.append(s)
	for j1 in range(i):
		n1 = list(range(i, j1, -1))
		s1 = ' ' * (j1 + 1) + ''.join(map(str, n1))
		final.append(s1)
for i in final:
	print(i)


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for k in range(len(a)):
	for w in range(a[k] + 1):
		nct = a[k] - w
		nqt = w + 1
		for i in range(nct):
			print(' ', end='')
		for j in range(nqt):
			print(a[k] - j, end='')
		print()
	for w in range(a[k] + 1):
		nqt = a[k] - w
		nct = w + 1
		for i in range(nct):
			print(' ', end='')
		for j in range(nqt):
			print(a[k] - j, end='')
		print()


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


for _ in range(int(input())):
	n = int(input())
	for i in range(n * 2 + 1):
		if i < n:
			s = ''
			s = s + (n - i) * ' '
			k = n
			for j in range(n - i, n + 1):
				s = s + str(k)
				k = k - 1
		elif i == n:
			s = ''
			for x in range(n, -1, -1):
				s = s + str(x)
		else:
			s = ''
			s = s + (i - n) * ' '
			k = n
			for j in range(i - n, n + 1):
				s = s + str(k)
				k = k - 1
		print(s)


t = int(input())
for i in range(0, t):
	k = int(input())
	b = []
	for j in range(k, -1, -1):
		a = []
		s = ' '
		a.append(str(s * j))
		for m in range(k, j - 1, -1):
			a.append(str(m))
		x = ''.join(a)
		b.append(x)
		print(*a, sep='')
	b.reverse()
	b.pop(0)
	print(*b, sep='\n')


for _ in range(int(input())):
	n = int(input())
	k = 2 * n + 1 - 1
	for i in range(n + 1):
		a = n
		for j in range(n, i, -1):
			print(end=' ')
		for k in range(i + 1):
			print(a, end='')
			a -= 1
		print()
	for i in range(n):
		b = n
		for j in range(n + 1):
			if j > i:
				print(b, end='')
				b -= 1
			else:
				print(end=' ')
		print()


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


for _ in range(int(input())):
	k = int(input())
	ans = [str(k)]
	s = str(k)
	n = k
	while n > 0:
		n -= 1
		s = s + str(n)
		ans.append(s)
	ans = ans + ans[:-1][::-1]
	for x in ans:
		z = ' ' * (k + 1 - len(x))
		print(z + x)


for _ in range(int(input())):
	k = int(input())
	whole = 2 * k + 1
	half = int(whole / 2)
	l = []
	for i in range(k, -1, -1):
		l.append(i)
	print(k)
	for i in range(1, half):
		for j in range(0, i + 1):
			print(l[j], end='')
		print()
	print(*l, sep='')
	for i in range(half, -1, -1):
		for j in range(0, i):
			print(l[j], end='')
		print()


T = int(input())
for t in range(T):
	N = int(input())
	for i in range(N, 0, -1):
		for j in range(i):
			print(' ', end='')
		for j in range(N, i - 1, -1):
			print(j, end='')
		print()
	for i in range(N + 1):
		for j in range(i):
			print(' ', end='')
		for j in range(N, i - 1, -1):
			print(j, end='')
		print()


import math
for z in range(int(input())):
	n = int(input())
	for i in range(n + 1):
		print((n - i) * ' ', end='')
		init = n
		for k in range(i + 1):
			print(init, end='')
			init -= 1
		print()
	for i in range(1, n + 1):
		print(i * ' ', end='')
		init = n
		for k in range(n - i + 1):
			print(init, end='')
			init -= 1
		print()


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(n, 0, -1):
		a.append(i)
	for i in range(1, n + 1):
		print(' ' * (n + 1 - i), end='')
		for j in a[0:i]:
			print(j, end='')
		print('')
	a.append(0)
	for i in a:
		print(i, end='')
	a.pop()
	print('')
	for i in range(1, n + 1):
		print(' ' * i, end='')
		for j in a[0:n - i + 1]:
			print(j, end='')
		print('')


t = int(input())
for i in range(t):
	K = int(input())
	l = list(range(K + 1))
	for x in range(2 * K + 1):
		print(' ' * abs(K - x), end='')
		for y in range(K + 1 - abs(K - x)):
			print(l[-y - 1], end='')
		print()


for i in range(int(input())):
	n = int(input())
	a = []
	for i in range(n + 1):
		s = ''
		for j in range(i + 1):
			s += str(n - j)
		s = ' ' * (n - i) + s
		a.append(s)
	print(*a, sep='\n')
	a.reverse()
	print(*a[1:], sep='\n')


t = int(input())
from itertools import permutations as p
for _ in range(t):
	n = int(input())
	for i in range(2 * n + 1):
		if i <= n:
			for j in range(n - i):
				print(' ', end='')
			for j in range(n, n - i - 1, -1):
				print(j, end='')
			print()
		else:
			for j in range(i - n):
				print(' ', end='')
			for j in range(n, i - n - 1, -1):
				print(j, end='')
			print()


t = int(input())
for i in range(t):
	n = int(input())
	ans = []
	meow = ''
	tot = n + 1
	for i in range(n, -1, -1):
		meow += str(i)
		an = ' ' * (tot - len(str(meow))) + str(meow)
		ans.append(an)
	for j in ans:
		print(j)
	ans = list(reversed(ans))
	ans.pop(0)
	for j in ans:
		print(j)