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

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

-----Output:-----
For each testcase, output as pattern.

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

-----Sample Input:-----
2
2
4

-----Sample Output:-----
2
12
012
12
2

4
34
234
1234
01234
1234
234
34
4

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

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import copy
for _ in range(int(input())):
	k = int(input())
	c = []
	d = []
	start = 0
	while True:
		c = []
		for i in range(start):
			c.append(' ')
		for i in range(start, k + 1):
			c.append(str(i))
		start += 1
		d.append(c)
		if start > k:
			break
	e = copy.copy(d[1:])
	d.reverse()
	d = d + e
	for i in range(len(d)):
		print(''.join(d[i]))


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
abc = 'abcdefghijklmnopqrstuvwxyz'
pi = 3.141592653589793
t = int(input())
for _ in range(t):
	k = int(input())
	k_buf = k * 1
	n_lines = k + 1
	for i in range(n_lines):
		buf = ' ' * k
		for j in range(k, k_buf + 1):
			buf = buf + str(j)
		k = k - 1
		print(buf)
	for i in range(1, k_buf + 1):
		buf = ' ' * i
		for j in range(i, k_buf + 1):
			buf = buf + str(j)
		print(buf)


for u in range(int(input())):
	n = int(input())
	l = []
	x = 0
	f = []
	for i in range(n + 1):
		f.append(' ')
	for i in range(n + 1):
		f = []
		for i in range(n + 1):
			f.append(' ')
		for j in range(x, n + 1):
			f[j] = str(j)
		x += 1
		l.append(f)
	d = l[1:][::-1]
	for i in d:
		print(''.join(i))
	for i in l:
		print(''.join(i))


for _ in range(int(input())):
	n = int(input())
	flag = False
	s = n
	for i in range(2 * n + 1):
		if s >= 0:
			for j in range(s):
				print(' ', end='')
			for j in range(n + 1 - s):
				print(j + s, end='')
		else:
			for j in range(abs(s)):
				print(' ', end='')
			for j in range(n + 1 - abs(s)):
				print(j + abs(s), end='')
		print()
		s -= 1


for i in range(int(input())):
	n = int(input())
	l = [' '] * (n + 1)
	l[-1] = n
	print(*l, sep='')
	for i in range(n - 1, -1, -1):
		l[i] = i
		print(*l, sep='')
	for i in range(n + 1):
		l[i] = ' '
		print(*l, sep='')