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.

Starter code:

Solutions:
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
inp = lambda: list(map(int,sys.stdin.readline().rstrip("\r\n").split()))
#_______________________________________________________________________________    _______________________
# from math import *
# from bisect import *
# from heapq import *
# from collections import defaultdict as dd
# from collections import OrderedDict as odict
# from collections import Counter as cc
# from collections import deque
# sys.setrecursionlimit(2*(10**5)+100) this is must for dfs
# mod = 10**9+7; md = 998244353
# ______________________________________________________________________________    ________________________
# segment tree for range minimum query
# sys.setrecursionlimit(10**5)
# n = int(input())
# a = list(map(int,input().split()))
# st = [float('inf') for i in range(4*len(a))]
# def build(a,ind,start,end):
#   if start == end:
#       st[ind] = a[start]
#   else:
#       mid = (start+end)//2
#       build(a,2*ind+1,start,mid)
#       build(a,2*ind+2,mid+1,end)
#       st[ind] = min(st[2*ind+1],st[2*ind+2])
# build(a,0,0,n-1)
# def query(ind,l,r,start,end):
#   if start>r or end<l:
#       return float('inf')
#   if l<=start<=end<=r:
#       return st[ind]
#   mid = (start+end)//2
#   return min(query(2*ind+1,l,r,start,mid),query(2*ind+2,l,r,mid+1,end))
# ______________________________________________________________________________    ________________________
# Checking prime in O(root(N))
# def isprime(n):
#     if (n % 2 == 0 and n > 2) or n == 1: return 0
#     else:
#         s = int(n**(0.5)) + 1
#         for i in range(3, s, 2):
#             if n % i == 0:
#                 return 0
#         return 1
# def lcm(a,b):
#   return (a*b)//gcd(a,b)
# ______________________________________________________________________________    ________________________
# nCr under mod
# def C(n,r,mod):
#   if r>n:
#       return 0
#   num = den = 1
#   for i in range(r):
#       num = (num*(n-i))%mod
#       den = (den*(i+1))%mod
#   return (num*pow(den,mod-2,mod))%mod
# M = 10**5 +10
# ______________________________________________________________________________    ________________________
# For smallest prime factor of a number
# M = 1000010
# pfc = [i for i in range(M)]
# def pfcs(M):
#   for i in range(2,M):
#       if pfc[i]==i:
#           for j in range(i+i,M,i):
#               if pfc[j]==j:
#                   pfc[j] = i
#   return
# pfcs(M)
# ______________________________________________________________________________    ________________________
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

# cook your dish here
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 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 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()

# Function for nth fibonacci number - Space Optimisataion 
# Taking 1st two fibonacci numbers as 0 and 1 
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 

# Driver Program 
for _ in range(1,101):
 s.append(fibonacci(_)) 
s[0]=0 

#This code is contributed by Saket Modi 

for _ in range(int(input())):
 n=int(input())
 # s=[0,1,1,2,3,5,8,13,21,34]
 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])
 # print(f[i], ' ')
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()

# cook your dish here
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

# cook your dish here
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