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:
def isPrime(n):
    if n == 1: return False
    if n % 2 == 0:
        return n == 2
    d = 3
    while d * d <= n and n % d != 0:
        d += 2
    return d * d > n

def wrong_square(x):
    bad = False
    n, m = len(x), len(x[0])
    for i in range(n):
        line_total = 0
        for j in range(m):
            if x[i][j] < 0: return True
            if isPrime(x[i][j]):
                bad = True
                return bad
            line_total += x[i][j]
        if not isPrime(line_total):
            bad = True
            return bad
   
    for j in range(m):
        col_total = 0
        for i in range(n):
            col_total += x[i][j]
        if not isPrime(col_total):
            bad = True
            return bad 
        
    return False

#wrong_square([[1,2],[1,1]])
#wrong_square([[4, 6, 8, 1],
#[4, 9, 9, 9],
#[4, 10, 10, 65],
#[1, 4, 4, 4]])


prime_numbers = [i for i in range(1000) if isPrime(i)]
not_prime_numbers = [i for i in range(1000) if not isPrime(i)]

def attach_new(x):
    
    n, m = len(x), len(x[0])
    y = [[0 for i in range(m+1)] for i in range(n+1)]
    for i in range(n):
        for j in range(m):
            y[i][j] = x[i][j]
    
    for i in range(n+1):
        total_line = 0
        for j in range(m+1):
            total_line += y[i][j]
            if i != n and j == m:
                idx = 0
                diff = prime_numbers[idx] - total_line
                cond = not isPrime(diff) and diff > 0
                while not cond:
                    idx += 1
                    diff = prime_numbers[idx] - total_line
                    cond = not isPrime(diff) and diff > 0           
                y[i][j] = diff
                
    for j in range(m+1):
        total = 0
        for i in range(n+1):
            total += y[i][j]
            if i == n and j != m:
                idx = 0
                diff = prime_numbers[idx] - total
                cond = not isPrime(diff) and diff > 0
                while not cond:
                    idx += 1
                    diff = prime_numbers[idx] - total
                    cond = not isPrime(diff) and diff > 0           
                y[i][j] = diff   
                
    last_col = 0
    for i in range(n):
        last_col += y[i][m]
        
    last_row = 0
    for j in range(m):
        last_row += y[n][j]  
        
    candidate = 1
    cond = isPrime(last_col + candidate) and isPrime(last_row + candidate)
    while not cond:
        candidate +=1
        cond = isPrime(last_col + candidate) and isPrime(last_row + candidate) and not isPrime(candidate)
    y[n][m] = candidate 
    return y

def print_square(x):
    
    n = len(x)
    output = ''
    for i in range(n):
        output += ' '.join(list(map(str,x[i])))
        if i != n-1:
            output += '\n'
    return output


t = int(input())
answers = []

xs = []
for _ in range(t):
    xs.append(int(input()))
    
base_square = [[1,1],[1,1]]
squares = [None, [[1]],base_square]

for i in range(2,max(xs)+1):
    squares.append(attach_new(squares[-1]))
    
for x in xs:
    answers.append(print_square(squares[x]))
    
for answer in answers:
    print(answer)