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

Solution:
#include <bits/stdc++.h>
using namespace std;
void solve1();
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long power(long long x, long long y) {
  long long res = 1;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long fib(long long s1) {
  long long s2, s4, s5, s3;
  s2 = s3 = 1;
  s4 = s5 = 0;
  while (s1 > 0) {
    if (s1 % 2 == 0) {
      long long s6 = s3 * s3;
      s3 = 2 * s5 * s3 + s6;
      s5 = s5 * s5 + s6;
      s1 /= 2;
    } else {
      long long s6 = s2 * s3;
      s2 = s4 * s3 + s6 + s2 * s5;
      s4 = s4 * s5 + s6;
      s1 -= 1;
    }
  }
  return s4;
}
long long sum(long long arr[], long long a, long long n) {
  long long zz = 0;
  for (long long i = a; i < n; i++) {
    zz += arr[i];
  }
  return zz;
}
void solve() {
  long long t;
  cin >> t;
  while (t--) {
    solve1();
  }
}
bool allprime[10000001] = {0};
vector<long long> sieve_of_primes_upto_10e6() {
  long long n = 10000000;
  vector<long long> set_of_primes;
  set_of_primes.push_back(2);
  long long p;
  for (p = 2; p * p <= n; p++) {
    if (allprime[p] == 0) {
      set_of_primes.push_back(p);
      for (long long i = p * p; i <= n; i += p) {
        allprime[i] = 1;
      }
    }
  }
  for (p; p <= n; p += 2) {
    if (allprime[p] == 0) {
      set_of_primes.push_back(p);
    }
  }
  return set_of_primes;
}
signed main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<long long> vec = sieve_of_primes_upto_10e6();
  solve();
  return 0;
}
void solve1() {
  long long n, m, a = 0, b;
  cin >> n;
  allprime[1] = 1;
  long long arr[n][n];
  for (long long i = n + 1; i < 200000; i++) {
    if (allprime[i] == 0 && allprime[i + 1 - n] == 1) {
      a = i;
      break;
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      arr[i][j] = 1;
    }
    arr[i][i] = a + 1 - n;
  }
  for (long long j = 0; j < n; j++) {
    for (long long i = 0; i < n; i++) cout << arr[j][i] << " ";
    cout << "\n";
    ;
  }
}