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

public class Main {
    static Scanner sc;
    static BufferedReader br;
    static PrintWriter out;

    public static void main(String[] args) throws Exception{
        sc = new Scanner(System.in);
        // br=new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        int max=(int)((1e5)+1);
        seive=new int[max];
        primes=new HashSet<>();
        for (int i = 2; i*i < max; i++) {
            if(seive[i]==0) {
                for (int j = i * i; j < max; j += i) {
                    seive[j]=1;
                }
                primes.add(i);
            }
        }

        int t = 1;
        t = sc.nextInt();
        while (t-- > 0) {
            forEachTestCase();
        }


        //  br.close();
        sc.close();
        out.close();
    }

    static int seive[];
    static HashSet<Integer> primes;


    static void forEachTestCase() throws  Exception{
        int n=sc.nextInt()-1;
        for (int i = 1; i <100001 ; i++) {
            if(!primes.contains(i) && primes.contains(i+n)){
                for (int j = 0; j <n+1 ; j++) {
                    for (int k = 0; k <n+1 ; k++) {
                        if(k==j)out.print(i+" ");
                        else out.print(1+" ");
                    }
                    out.println();
                }
                return;
            }
        }
    }



    static void remove(TreeMap<Integer,Integer> tm,int key){
        int fre=tm.get(key);
        if(fre==1){
            tm.remove(key);
            return;
        }
        tm.put(key,fre-1);
    }
    static long mod = 1000000007;


    static long[][] mul(long a[][],long b[][]){
        long ans[][]=new long[a.length][b[0].length];
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <b[0].length ; j++) {
                for (int k = 0; k <a[0].length ; k++) {
                    ans[i][j]=add(ans[i][j],mul(a[i][k],b[k][j]));
                }
            }
        }
        return ans;
    }
    static long add(long a, long b) {
        a %= mod;
        b %= mod;
        return (a + b) % mod;
    }

    static long mul(long a, long b) {
        a %= mod;
        b %= mod;
        return (a * b) % mod;
    }

    static long sub(long a, long b) {
        a %= mod;
        b %= mod;
        return (((a - b) % mod) + mod) % mod;
    }

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

    static long modPow(long a, long b) {
        long ans = 1;
        while (b > 0) {
            if (b % 2 == 1) {
                ans = mul(ans, a);
            }
            a = mul(a, a);
            b >>= 1;
        }
        return ans;
    }

    static long modInv(long a) {
        return modPow(a, mod - 2);
    }


    static class DSU{
        int n,par[],size[],connectedComponent;
        DSU(int n){
            this.n=n;
            par=new int[n];
            size=new int[n];
            connectedComponent=n;
            for(int i=0;i<n;i++){
                par[i]=i;
                size[i]=1;
            }
        }
        int root(int u){
            if(u==par[u]){
                return u;
            }
            return par[u]=root(par[u]);
        }
        boolean isConnected(int u,int v){
            u=root(u);
            v=root(v);
            if(u==v)return true;
            return false;
        }
        void union(int u,int v){
            u=root(u);
            v=root(v);
            if(u!=v){
                if(size[u]<size[v]){
                    int temp=u;
                    u=v;
                    v=temp;
                }
                size[u]+=size[v];
                par[v]=u;
                connectedComponent--;
            }
        }
        boolean oneComponent(){
            if(connectedComponent==1)return true;
            return false;
        }
    }
}