Problem: Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. 

A square of size n × n is called prime if the following three conditions are held simultaneously: 

  * all numbers on the square are non-negative integers not exceeding 10^5; 
  * there are no prime numbers in the square; 
  * sums of integers in each row and each column are prime numbers. 



Sasha has an integer n. He asks you to find any prime square of size n × n. Sasha is absolutely sure such squares exist, so just help him!

Input

The first line contains a single integer t (1 ≤ t ≤ 10) — the number of test cases.

Each of the next t lines contains a single integer n (2 ≤ n ≤ 100) — the required size of a square.

Output

For each test case print n lines, each containing n integers — the prime square you built. If there are multiple answers, print any.

Example

Input


2
4
2


Output


4 6 8 1
4 9 9 9
4 10 10 65
1 4 4 4
1 1
1 1

Solution (in PYTHON3):

Solution:
# _______________________________________________________________#
from math import *
import threading
import sys


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)


def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1

	while (start <= end):
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer  # index where x is not less than num


def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1

	while (start <= end):
		middle = (end + start) // 2

		if li[middle] <= num:
			answer = middle
			start = middle + 1

		else:
			end = middle - 1
	return answer  # index where x is not greater than num


def abs(x):
	return x if x >= 0 else -x


def binary_search(li, val, lb, ub):
	ans = -1
	while (lb <= ub):
		mid = (lb + ub) // 2
		# print(mid, li[mid])
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:	
			lb = mid + 1
		else:
			ans = mid # return index
			break
	return ans


def kadane(x):  # maximum sum contiguous subarray
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far


def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum


def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		a, b = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj


def SieveOfEratosthenes(n):
	prime = [True for i in range(n+1)]
	p = 2
	li = []
	while (p * p <= n):
		if (prime[p] == True):
			for i in range(p * p, n+1, p):
				prime[i] = False
		p += 1

	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li


# _______________________________________________________________#


INF = 1e9
# sys.setrecursionlimit(900000)
# threading.stack_size(10**5)  # remember it cause mle
# def main():
primes = SieveOfEratosthenes(1300000)
def fn(n):
	i = 2
	res = n-1
	val = 0
	for i in range(int(sqrt(n))+1,1,-1):
	
		val = i - 1 + int(ceil((n-i)/i))
		#print(val,res)
		if val <= res:
			#print(i)
			res = val
		else:
			break
		
	return res


def solve(a,b,c): 
	dis = (b**2) - (4 * a*c) 

	# find two results 
	ans1 = (-b-sqrt(dis))/(2 * a) 
	#ans2 = (-b + cmath.sqrt(dis))/(2 * a) 

	# printing the results 
	#print('The roots are') 
	print(int(ans1)) 
	#print(ans2) 	
	return
	

for _ in range(int(input())):
#for _ in range(1):
	n = int(input())
	#n,m = map(int, input().split())
	# s = list(input())
	# a = [int(x) for x in s]
	# s = list(input())
	#a = list(map(int, input().split()))
	#b = list(map(int,input().split()))
	#c = list(map(int,input().split()))
	# adj = graph(n,m)
	ans = ['0']*(n-2)
	ans += ['1', '1']
	for i in range(n):
		temp = ans[i:] + ans[:i]
		print(*temp)

			





















'''		
t = threading.Thread(target=main)
t.start()
t.join()
'''