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 JAVA):

Solution:
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner; 
import java.util.Set;
import java.util.StringTokenizer; 
  
    public class FastReader { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
        
    public static void main(String[] args) {
        FastReader r = new FastReader();
        int[] muodot = new int[r.nextInt()];
        
        for (int i = 0; i < muodot.length; i++) {
            muodot[i] = r.nextInt();
        }
        
        for (int i = 0; i < muodot.length; i++) {
            muodostaTaulukko(muodot[i]);
        }
    }
    
    public static void muodostaTaulukko(int koko) {
        int[][] t = new int[koko][koko];
        int aseta = 1;
        int normiAse = 1;
        
        for (int i = 0; i < koko-1; i++) {
            for (int j = 0; j < koko; j++) {
                if (j != koko - 1) {
                    t[i][j] = normiAse;
                } else {
                    int sum = 0;
                    for (int k = 0; k < koko-1; k++) {
                            sum += t[i][k];
                        }
                    while (true){
                        sum += aseta;
                        if (!tarkastaPrime(aseta)) {
                            if (tarkastaPrime(sum)) {
                                t[i][j] = aseta;
                                break;
                            }
                        }
                        sum -= aseta;
                        aseta++;
                    }
                }
            }
        }

        int x = koko-1;
        int sum = 0; 
        int laita = 1;

        for (int i = 0; i < koko-1; i++) {
            sum = 0;
            for (int j = 0; j < koko-1; j++) {
                sum += t[j][i];
            }
            while (true) {
                sum += laita;
                    if (!tarkastaPrime(laita)) {
                        if (tarkastaPrime(sum)) {
                            t[x][i] = laita;
                            break;
                        }
                    }
                    sum -= laita;
                    laita++;           
                }
        }
        
        int pystySum = 0; 
        int vaakaSum = 0;
        
        for (int i = 0; i < koko-1; i++) {
            pystySum += t[i][koko-1];
            vaakaSum += t[koko-1][i];
        }

        aseta = 1;
        while (true) {
            if (!tarkastaPrime(aseta)) {
                pystySum += aseta;
                vaakaSum += aseta;
                
                if (tarkastaPrime(pystySum)) {
                    if (tarkastaPrime(vaakaSum)) {
                        t[koko-1][koko-1] = aseta;
                        break;
                    } 
                }
                pystySum -= aseta;
                vaakaSum -= aseta;
            }
            
            aseta++;
        }
        tulostaT(t);
    }
    

    static void tulostaT(int[][] t) {
        for (int i = 0; i < t.length; i++) {
            for (int j = 0; j < t.length; j++) {
                System.out.print(t[i][j] + " ");
            }
            System.out.println("");
        }
    }
    

        
    
    static boolean tarkastaPrime(int prime) {
        boolean isItPrime = true;

        if(prime <= 1) {
            isItPrime = false;
            return isItPrime;
            } else {
            for (int i = 2; i<= prime/2; i++) {
            if ((prime % i) == 0) {
                isItPrime = false;
                break;
            }
        }
            return isItPrime;
        }
    }
        public String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine()); 
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        public int nextInt() { 
            return Integer.parseInt(next()); 
        } 
  
        public long nextLong() { 
            return Long.parseLong(next()); 
        } 
  
        public double nextDouble() { 
            return Double.parseDouble(next()); 
        } 
  
        public String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) { 
                e.printStackTrace(); 
            }
            return str; 
        } 
        
    
}