The chef is trying to decode 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 10$
- $1 \leq K \leq 10$

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

-----Sample Output:-----
0 
0 
1 1 
0 
1 1 
2 3 5 
0 
1 1 
2 3 5 
8 13 21 34  

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

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda : list(map(int, sys.stdin.readline().rstrip('\r\n').split()))
tc = 1
(tc,) = inp()
a = [0, 1]
for i in range(100000):
	a.append(a[-1] + a[-2])
for _ in range(tc):
	(n,) = inp()
	start = 0
	for i in range(n):
		print(*a[start:start + i + 1])
		print()
		start += i + 1


f = []
for i in range(100000 + 1):
	if i == 0:
		f.append(0)
	elif i == 1:
		f.append(1)
	else:
		f.append(f[-1] + f[-2])
for _ in range(int(input())):
	n = int(input())
	count = 0
	for i in range(1, n + 1):
		for j in range(i):
			print(f[count], end=' ')
			count += 1
		print()


def solve(n):
	if n == 1:
		print('0')
		return
	l = 3
	p1 = 1
	p2 = 1
	print('0')
	print('1 1')
	for i in range(n - 2):
		x = ''
		for i in range(l):
			nt = p1 + p2
			c = p2
			p2 = nt
			p1 = c
			x += str(nt)
			if i != l - 1:
				x += ' '
		print(x)
		l += 1

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		solve(n)
main()


def func(num):
	no_terms = num * (num + 1) // 2
	lst = [0, 1]
	for i in range(2, no_terms):
		lst.append(lst[i - 1] + lst[i - 2])
	k = 0
	for i in range(1, num + 1):
		for j in range(i):
			print(lst[k], ' ', end='')
			k += 1
		print()
for _ in range(int(input())):
	num = int(input())
	func(num)


def f(n):
	if n == 1:
		return print(0)
	print('0\n1 1')
	if n == 2:
		return
	fibo = [0, 1, 1]
	p = 3
	line = 3
	while line <= n:
		for _ in range(line):
			fibo.append(fibo[-1] + fibo[-2])
			print(fibo[-1], '', end='')
		print()
		line += 1
t = int(input())
answers = list()
for _ in range(t):
	n = int(input())
	answers.append(n)
for answer in answers:
	f(answer)


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


t = int(input())
for _ in range(t):
	n = int(input())
	a = 1
	b = 2
	for i in range(n):
		for j in range(i + 1):
			if i == 0:
				print('0', end=' ')
			elif i == 1:
				print('1', end=' ')
			else:
				print(b, end=' ')
				c = b
				b = a + b
				a = c
		print()


s = []

def fibonacci(n):
	a = 0
	b = 1
	if n < 0:
		print('Incorrect input')
	elif n == 0:
		return a
	elif n == 1:
		return b
	else:
		for i in range(2, n):
			c = a + b
			a = b
			b = c
		return b
for _ in range(1, 101):
	s.append(fibonacci(_))
s[0] = 0
for _ in range(int(input())):
	n = int(input())
	p = 0
	for _ in range(1, n + 1):
		for __ in range(1, _ + 1):
			print(s[p], end=' ')
			p += 1
		print()
	print()


t = int(input())
f = [0, 1]
for i in range(2, 100):
	f.append(f[i - 1] + f[i - 2])
for i in range(t):
	n = int(input())
	cnt = 0
	for j in range(1, n + 1):
		for k in range(1, j + 1):
			print(f[cnt], end=' ')
			cnt += 1
		print()


t = int(input())
tp = []
tp.append(0)
tp.append(1)
for i in range(2, 5050):
	tp.append(tp[i - 1] + tp[i - 2])
for i in range(t):
	n = int(input())
	c = 0
	for j in range(1, n + 1):
		for k in range(1, j + 1):
			print(tp[c], sep=' ', end=' ')
			c += 1
		print()


for _ in range(int(input())):
	n = int(input())
	r = 2
	if n == 1:
		print('0')
		continue
	print('0')
	print('1 1')
	b = 1
	c = 0
	for i in range(3, n + 1):
		for j in range(i):
			print(r, end=' ')
			c = r
			r += b
			b = c
		print()


for _ in range(int(input())):
	K = int(input())
	if K == 1:
		print(0)
	elif K == 2:
		print(0)
		print(*[1, 1])
	else:
		print(0)
		print(*[1, 1])
		l = 1
		c = 1
		for i in range(2, K):
			A = []
			for j in range(i + 1):
				A.append(l + c)
				l = c
				c = A[-1]
			print(*A)


t = int(input())
while t:
	t = t - 1
	k = int(input())
	if k == 1:
		print('0')
	else:
		a = 1
		b = 1
		print('0')
		print('1 1')
		for i in range(2, k):
			for j in range(0, i + 1):
				c = a + b
				print(c, end=' ')
				a = b
				b = c
			print()


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	n = int(inp())
	ml = [0]
	for i in range(1, n + 1):
		for j in range(i):
			print(ml[-1], end=' ')
			if len(ml) == 1:
				ml.append(ml[-1] + 1)
			else:
				ml.append(ml[-1] + ml[-2])
		print()


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


t = int(input())
arr = [0, 1]
for i in range(2, 101):
	arr.append(arr[i - 1] + arr[i - 2])
while t > 0:
	n = int(input())
	m = 0
	for i in range(0, n):
		for j in range(0, i + 1):
			print(arr[m], end=' ')
			m += 1
		print()
	t -= 1