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;
bool prime[500001];
vector<long long> v;
void seive_of_eras(long long n) {
  prime[0] = prime[1] = true;
  for (long long i = 2; i <= n; i++) {
    if (prime[i] == false) {
      v.push_back(i);
      for (long long j = 2 * i; j <= n; j += i) {
        prime[j] = true;
      }
    }
  }
}
long long power(long long x, unsigned long long y, unsigned long long m) {
  if (y == 0) return 1;
  long long p = power(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long modInverse(long long a, long long m) { return power(a, m - 2, m); }
long long nCrModPFermat(long long n, long long r, long long p) {
  if (r == 0) return 1;
  long long fac[n + 1];
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long tt = 1;
  cin >> tt;
  seive_of_eras(500000);
  while (tt-- > 0) {
    long long n = 0;
    cin >> n;
    if (n == 1) {
      cout << "1";
      cout << "\n";
    } else if (prime[n] == 0) {
      for (long long i = 0; i < n; ++i) {
        for (long long j = 0; j < n; j++) {
          cout << "1 ";
        }
        cout << "\n";
      }
    } else {
      long long x = 0;
      for (long long i = 0; i < v.size(); ++i) {
        long long y = v[i] / n;
        long long z = v[i] % n;
        if (prime[y] == 1 && prime[z + y] == 1 && y != 0 && z != 0) {
          vector<long long> ans;
          for (long long i = 0; i < n - 1; ++i) {
            ans.push_back(y);
          }
          ans.push_back(z + y);
          for (long long j = 0; j < n; j++) {
            for (long long k = 0; k < n; k++) {
              cout << ans[(j + k) % n] << " ";
            }
            cout << "\n";
          }
          break;
        }
      }
    }
  }
  return 0;
}