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;
const int Hash = 131;
const int maxn = 1e5 + 5;
const int maxm = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-7;
const double pi = acos(-1);
inline long long lowbit(long long x) { return x & (-x); }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
void ex_gcd(long long a, long long b, long long &d, long long &x,
            long long &y) {
  if (!b) {
    d = a, x = 1, y = 0;
  } else {
    ex_gcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
inline long long qpow(long long a, long long b, long long MOD = mod) {
  long long res = 1;
  a %= MOD;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res % MOD;
}
inline long long qmul(long long a, long long b, long long MOD = mod) {
  return (a * b - (long long)((long double)a / MOD * b) * MOD + MOD) % MOD;
}
inline long long inv(long long x, long long p) { return qpow(x, p - 2, p); }
inline long long Inv(long long a, long long p) {
  long long x, y, d;
  ex_gcd(a, p, d, x, y);
  return (x % p + p) % p;
}
inline long long jos(long long n, long long k, long long s = 1) {
  long long res = 0;
  for (long long i = 1; i < n + 1; ++i) res = (res + k) % i;
  return (res + s) % n;
}
double F(double x) { return x; }
inline double sim(double l, double r) {
  return (F(l) + 4. * F((l + r) / 2.) + F(r)) * (r - l) / 6.;
}
double asr(double l, double r, double ans, double eps) {
  double m = l + (r - l) / 2., L = sim(l, m), R = sim(m, r);
  return fabs(L + R - ans) <= 15. * eps
             ? L + R + (L + R - ans) / 15.
             : asr(l, m, L, eps / 2) + asr(m, r, R, eps / 2);
}
double asr(double l, double r, double eps) { return asr(l, r, sim(l, r), eps); }
namespace IO {
void read() {}
void write() {}
template <typename T, typename... T2>
inline void read(T &x, T2 &...oth) {
  int sign = 1;
  x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') sign = -1;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  x *= sign;
  read(oth...);
}
char end = '\n';
template <typename T, typename... T2>
inline void write(T x, T2 &...oth) {
  if (x < 0) {
    x = -x;
    putchar('-');
  };
  static int sta[25];
  int top = 0;
  do {
    sta[top++] = x % 10;
  } while (x /= 10);
  while (top) putchar(sta[--top] + '0');
  putchar(end);
  write(oth...);
}
}  // namespace IO
using namespace IO;
int n, m, x;
int a[105];
bool is_prime(int x) {
  if (x < 2)
    return false;
  else
    for (long long i = 2; i < x; ++i)
      if (!(x % i)) return false;
  return true;
}
inline void solve() {
  read(n);
  int t = 0;
  for (long long i = 1; i < maxn; ++i)
    if (is_prime(i * (n - 1) + 1) && !is_prime(i)) {
      t = i;
      break;
    }
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < n; ++j) printf("%d ", i == j ? 1 : t);
    cout << endl;
  }
}
int main() {
  int QwQ, QAQ = 1;
  for (read(QwQ); QwQ; QwQ--) solve();
  return 0;
}