Sarthak got an empty magic grid of size N \times N on his birthday. The grid can only be filled with positive integers such that the [bitwise XOR] of all numbers from any row, any column, or any of the two main diagonals must all be the same! Can you help Sarthak fill this grid using only positive integers no more than 10^{9}?

------ Input Format ------ 

- The first line of each input contains T - the number of test cases. The test cases then follow.
- The only line of each test case contains an integer N - the size of the grid.

------ Output Format ------ 

For each test case, output N lines, each containing N space-separated integers, such that the grid satisfies the condition given in the statement.

Each integer should be positive and ≤ 10^{9}.

------ Constraints ------ 

$1 ≤ T ≤ 100$
$1 ≤ N ≤ 100$

----- Sample Input 1 ------ 
1
3
----- Sample Output 1 ------ 
1 1 1
1 1 1
1 1 1

----- explanation 1 ------ 
The bitwise XOR of all rows, columns and main diagonals in the grid is $1$. Therefore, this satisfies the condition.

Source: codechef | Difficulty: EASY
Tags: Bit manipulation


Solutions:
for _ in range(int(input())):
	n = int(input())
	for x in range(n):
		print(' '.join(['1'] * n))


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


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


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


for _ in range(int(input())):
	n = int(input())
	l = [[1 for i in range(n)] for j in range(n)]
	for arr in l:
		print(*arr)


for _ in range(int(input())):
	N = int(input())
	for i in range(N):
		for j in range(N):
			print(1, end=' ')
		print()


for m in range(int(input())):
	k = int(input())
	for i in range(k):
		for j in range(k):
			print('1', end=' ')
		print()


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


t = int(input())
for tc in range(t):
	n = int(input())
	b = [1] * n
	for j in range(n):
		print(*b)


t = int(input())
for i in range(t):
	n = int(input())
	for i in range(n):
		for i in range(n):
			print(n // n, end='  ')
		print()


tc = int(input())
for _ in range(tc):
	n = int(input())
	s = [1] * n
	for i in range(n):
		print(*s)


a = int(input())
for i in range(a):
	b = int(input())
	for i in range(b):
		c = []
		for i in range(b):
			c.append(1)
		print(*c)


for i in range(int(input())):
	n = int(input())
	a = []
	b = []
	for k in range(n + 1):
		b.append(1)
	for j in range(n + 1):
		a.append(b)
	for g in a:
		print(*g)


for i in range(int(input())):
	a = int(input())
	for i in range(a):
		l = []
		for i in range(a):
			l.append(1)
		print(*l)


t = int(input())
while t != 0:
	n = int(input())
	for i in range(n):
		st = ('1 ' * n)[0:-1]
		print(st)
	t -= 1


for tc in range(int(input())):
	n = int(input())
	for i in range(n):
		print(*[1] * n)


t = int(input())
for _ in range(t):
	n = int(input())
	k = [1] * n
	for i in range(n):
		print(*k)


for _ in range(int(input())):
	size = int(input())
	for i in range(size):
		print(' '.join(['1'] * size))


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


for i in range(int(input())):
	a = int(input())
	for i in range(a):
		for j in range(a):
			print('1 ', end='')
		print('')


for tc in range(int(input())):
	n = int(input())
	for i in range(n):
		for j in range(n):
			print('1', end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	for i in range(n):
		a = [1] * n
		print(*a)


T = int(input())
for _ in range(T):
	n = int(input())
	a = ' '.join('1' * n)
	for _ in range(n):
		print(a)


for t in range(int(input())):
	N = int(input())
	for i in range(N):
		print('1 ' * N)


def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		for i in range(N):
			for j in range(N):
				print('1', end=' ')
			print()
main()


for __ in range(int(input())):
	n = int(input())
	for i in range(n):
		for j in range(n):
			print('1', end=' ')
		print()
	print()


for _ in range(int(input())):
	x = int(input())
	for i in range(x):
		print('1 ' * x)


t = int(input())
for i in range(t):
	n = int(input())
	A = []
	for j in range(0, n):
		A.append('1')
	for k in range(0, n):
		print(*A)


for _ in range(int(input())):
	n = int(input())
	grid = n * '1 '
	for i in range(n):
		print(grid)


t = int(input())
for i in range(t):
	n = int(input())
	grid = [1] * n
	for j in range(n):
		print(*grid)


t = int(input())
for i in range(t):
	n = int(input())
	a = [1] * n
	for j in range(n):
		print(*a)


for _ in range(int(input())):
	n = int(input())
	g = [[1 for _ in range(n)] for _ in range(n)]
	for i in g:
		print(*i)


for _ in range(int(input())):
	n = int(input())
	for _ in range(n):
		for _ in range(n):
			print('1', end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	x = ['1' for j in range(n)]
	for k in range(n):
		print(' '.join(x))


t = int(input())
while t != 0:
	n = int(input())
	l = []
	for i in range(n):
		for j in range(n):
			print(1, end=' ')
		print()
	t -= 1


t = int(input())
for ni in range(t):
	n = input()
	for i in range(int(n)):
		print('1 ' * int(n))


t = int(input())
for i in range(t):
	n = int(input())
	current_row = []
	for j in range(n):
		for k in range(n):
			current_row.append(1)
		print(*current_row)
		current_row.clear()


a = int(input())
for i in range(a):
	b = int(input())
	for j in range(0, b):
		for i in range(0, b):
			print('1', end=' ')
		print()


t = int(input())
while t > 0:
	N = int(input())
	for x in range(N):
		for y in range(N):
			print('1 ', end='')
		print('')
	t -= 1


for _ in range(int(input())):
	a = int(input())
	for i in range(a):
		for j in range(a):
			print('1 ' * a)
			break
	print()


k = int(input())
for i in range(k):
	s = int(input())
	for i in range(s):
		for j in range(s):
			print('1', end=' ')
		print('')