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.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class Solution {

    public static void main(String[] args) throws IOException {
        FastReader fr = new FastReader();
        FastWriter fw = new FastWriter();
        // write code here
        int t = fr.nextInt();

        while (--t >= 0) {
            int n = fr.nextInt();
            Pair pair = sieveOfEratosthenes(150000);
            int [] primes = pair.primes;
            boolean [] prime = pair.prime;

            int num = n;
            while (prime[num])
                num = num+1;
            int val = num*(n-1);

            int l=0, r=10000, mid = 0;
            while (l<r) {
                mid = (l+r)/2;
                if (primes[mid]<=val) {
                    l = mid + 1;
                } else {
                    r = mid;
                }
            }
            int diff = primes[mid] - val;
            while (diff<0 || prime[diff]) {
                mid++;
                diff = primes[mid] - val;
            }

            for (int i=0; i<n; i++) {
                for (int j=0; j<n; j++) {
                    if (j==i) {
                        fw.print(diff + " ");
                    } else {
                        fw.print(num + " ");
                    }
                }
                fw.println("");
            }
        }
        fw.flush();
    }

    static class Pair {
        int[] primes;
        boolean[] prime;
        public Pair(int[] p, boolean[] b) {
            prime = b;
            primes = p;
        }
    }

    static Pair sieveOfEratosthenes(int n)
    {
        int primes[] = new int[n+1];
        boolean prime[] = new boolean[n+1];
        for(int i=0;i<n;i++)
            prime[i] = true;

        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;
            }
        }
        for(int i = 2, k=-1; i <= n; i++)
        {
            if(prime[i] == true) {
                primes[++k] = i;
            }

        }
        prime[1] = false;
        return new Pair(primes, prime);
    }

}


class FastReader {
    public FastReader() {
    }

    public FastReader(String fileName) throws FileNotFoundException {
        this.br = new BufferedReader(new FileReader(fileName));
    }

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;

    String nextString() throws IOException {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextString());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextString());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextString());
    }
}

class FastWriter {
    public FastWriter() {
    }

    public FastWriter(String fileName) throws IOException {
        this.bw = new BufferedWriter(new FileWriter(fileName));
    }

    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

    void print(Object o) throws IOException {
        bw.write(o.toString());
        //        bw.flush();
    }

    void println(Object o) throws IOException {
        print(o.toString() + "\n");
    }

    void printSp(Object o) throws IOException {
        print(o.toString() + " ");
    }

    void flush() throws IOException {
        bw.flush();
    }
}