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>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse4")
using namespace std;
template <typename T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
void ckmin(T& a, T b) {
  a = min(a, b);
}
template <class T>
void ckmax(T& a, T b) {
  a = max(a, b);
}
int pct(int x) { return __builtin_popcount(x); }
int pctll(long long x) { return __builtin_popcountll(x); }
void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(), "w", stdout); }
void unsyncIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
void setIO(string s = "") {
  unsyncIO();
  if ((int)(s).size()) {
    setIn(s + ".in"), setOut(s + ".out");
  }
}
long long pow(long long b, long long e, long long m = 0LL,
              long long ans = 1LL) {
  while (e) {
    if (e & 1LL) {
      ans *= b;
      if (m) ans %= m;
    }
    b *= b, e >>= 1LL;
    if (m) b %= m;
  }
  return ans;
}
template <typename T>
vector<T> readVector(int n) {
  vector<T> res(n);
  for (int i = 0; i < n; i++) cin >> res[i];
  return res;
}
const int MOD = 1e9 + 7;
const int mxN = 2e5 + 5;
const int INF = 2e9;
const long long INFLL = 1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-8;
const int dx4[4] = {1, 0, -1, 0}, dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {-1, -1, 0, 1, 1, 1, 0, -1},
          dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const char nl = '\n';
bool isPrime(int x) {
  if (x <= 1) return false;
  if (x <= 3) return true;
  for (int i = 2; i * i <= x; ++i) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
void solve(int tcn) {
  int n;
  cin >> n;
  vector<vector<int> > ans(n, vector<int>(n, 1));
  int have = n - 1;
  int found = -1;
  for (int i = (1); i < (1e5 + 1 - have); ++i) {
    if (isPrime(have + i) && !isPrime(i) && isPrime(i * (n - 1) + 1)) {
      found = i;
      break;
    }
  }
  for (int i = (0); i < (n); ++i) {
    ans[i][n - 1] = ans[n - 1][i] = found;
  }
  ans[n - 1][n - 1] = 1;
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (n); ++j) {
      if (j > 0) cout << " ";
      cout << ans[i][j];
    }
    cout << nl;
  }
}
int main() {
  setIO("");
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; ++i) {
    solve(i);
  }
  return 0;
}