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

public class SolutionB extends Thread {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    private static final FastReader scanner = new FastReader();
    private static final PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new Thread(null, new SolutionB(), "Main", 1 << 26).start();
    }
    public static List<Integer> getPrimesInIntervalInclusive(int lower, int higher) {
        List<Integer> primes = new ArrayList<>();

        boolean[] sieve = new boolean[higher+1];

        for (int i = 2; i < sieve.length; i++) {
            if (!sieve[i]) {
                for (int j = 2 * i; j < sieve.length; j+=i) {
                    sieve[j] = true;
                }
                if (i >= lower) {
                    primes.add(i);
                }
            }
        }

        return primes;
    }

    static List<Integer> primes;

    public void run() {

        primes = getPrimesInIntervalInclusive(0, 10_000);

        int t = scanner.nextInt();
        for (int i = 0; i < t; i++) {
            solve();
        }
        out.close();
    }

    public static boolean isPrime(long n) {
        if (n == 2 || n == 3) {
            return true;
        } else if (n < 2) {
            return false;
        }
        if (n % 2 == 0) {
            return false;
        }
        if (n % 3 == 0) {
            return false;
        }
        if (n < 9) {
            return true;
        }

        for (int i = 5; i <= Math.sqrt(n); i+=6) {
            if (n % i == 0) {
                return false;
            }
            if (n % (i + 2) == 0) {
                return false;
            }
        }
        return true;
    }

    private static void solve() {
        int n = scanner.nextInt();

        int sum = 4 * n - 4;

        for (Integer prime: primes) {
            if (prime > sum && !isPrime(prime - sum)) {
                printGrid(n, prime - sum);
                return;
            }
        }


    }

    private static void printGrid(int n, int prime) {
        for (int i = 0; i < n; i++) {
            List<Integer> output = new ArrayList<>();
            for (int j = 0; j < n; j++) {
                if (i == j) {
                    output.add(prime);
                } else {
                    output.add(4);
                }
            }
            out.println(output.stream().map(String::valueOf).collect(Collectors.joining(" ")));
        }
    }

    //WARNINGS:
    //- CHECK FOR INTEGER-OVERFLOW BEFORE SUBMITTING
}