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.*;
import java.util.*;
import java.util.spi.AbstractResourceBundleProvider;

public class Main {

    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }


    static FastReader f = new FastReader();
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static StringBuilder sb = new StringBuilder("");
    private static int m = (int)1e9 + 7;
    static int MAX = 500005;

    static int[] inputArray(int n) throws IOException {
        int[] a = new int[n];
        for(int i = 0 ; i < n ; i++) {
            a[i] = f.nextInt();
        }
        return a;
    }

    static int gcd(int a , int b) {
        if(a % b == 0) {
            return b;
        }
        return gcd(b , a % b);
    }


    static long moduloInversePrime(long a) {
        long ans = modPow(a , m - 2);
        //System.out.println("modulo inverse of " + a + " -> " + ans);
        return ans;
    }

    static long mult(long a, long b)
    {
        return (a * (long)b % m);
    }

    static long modPow(long a, int step)
    {
        long ans = 1;
        while(step != 0)
        {
            if((step & 1) != 0)
                ans = mult(ans , a);
            a = mult(a , a);
            step >>= 1;
        }
        return ans;
    }

    static long longModulus(long x , long m) {
        long d = x / m;
        return x - d * m;
    }

    static boolean isTriangle(int a , int b , int c) {
        return a + b > c && a + c > b && c + b > a;
    }

    private static void swap(int arr[] , int i , int j) {
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }

    static class Container {
        int x , y , noise;
        Container(int x , int y , int noise) {
            this.x = x;
            this.y = y;
            this.noise = noise;
        }
        @Override
        public String toString() {
            return "x: " + x + " y: " + y + " noise: " + noise;
        }
    }

    static boolean[] sieveOfEratosthenes(int n)
    {
        boolean prime[] = new boolean[n+1];
        for(int i=0;i<n;i++)
            prime[i] = true;
        prime[1] = false;
        for(int p = 2; p*p <=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[p] == true)
            {
                // Update all multiples of p
                for(int i = p*p; i <= n; i += p)
                    prime[i] = false;
            }
        }
        return prime;
    }


    public static void main(String[] args) throws IOException {
        int t = f.nextInt();
        int maxx =  (int) 1e5;
        boolean[] isPrime = sieveOfEratosthenes(maxx);
        //System.out.println(Arrays.toString(isPrime));
        while(t-- != 0) {
            int n = f.nextInt();
            if(isPrime[n]) {
                for(int i =0 ; i < n ; i++) {
                    for(int j =0 ; j < n ; j++) {
                        System.out.print(1 + " ");
                    }
                    System.out.println();
                }
            }
            else {
                int dif = 1;
                //System.out.println("dif " + dif);
                //System.out.println(isPrime[n+dif] + " " + isPrime[dif+1]);
                while(n+dif <= maxx && (!isPrime[n+dif] || isPrime[dif+1])) {
                    //System.out.println("dif " + dif);
                    //System.out.println(isPrime[n+dif] + " " + isPrime[dif+1]);
                    //System.out.println(dif + " " + isPrime[n+dif]);
                    dif++;
                }
                for(int i =0 ; i < n ; i++) {
                    for(int j =0 ; j < n ; j++) {
                        if(i == j) {
                            System.out.print(dif + 1 + " ");
                        }
                        else {
                            System.out.print(1 + " ");
                        }
                    }
                    System.out.println();
                }
            }
        }
    }


}
/*

2 3 3
1 1 1
3 2 0
2 1 1 2 2
0 2 1 4 5
5 1 1 5 5


 */