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;
int main() {
  int n, i, j, k, l, z, d, m;
  cin >> n;
  int a[46];
  a[0] = 2, a[1] = 3, a[2] = 5, a[3] = 7, a[4] = 11, a[5] = 13, a[6] = 17,
  a[7] = 19, a[8] = 23, a[9] = 29, a[10] = 31, a[11] = 37, a[12] = 41,
  a[13] = 43, a[14] = 47, a[15] = 53, a[16] = 59, a[17] = 61, a[18] = 67,
  a[19] = 71, a[20] = 73, a[21] = 79, a[22] = 83, a[23] = 89, a[24] = 97,
  a[25] = 101, a[26] = 103, a[27] = 107, a[28] = 109, a[29] = 113, a[30] = 127,
  a[31] = 131, a[32] = 137, a[33] = 139, a[34] = 149, a[35] = 151, a[36] = 157,
  a[37] = 163, a[38] = 167, a[39] = 173, a[40] = 179, a[41] = 181, a[42] = 191,
  a[43] = 193, a[44] = 197, a[45] = 199;
  for (i = 0; i < n; i++) {
    cin >> m;
    for (j = 0; j <= 45; j++) {
      if (m <= a[j]) {
        break;
      }
    }
    if (m == a[j]) {
      for (k = 0; k < m; k++) {
        for (l = 0; l < m; l++) {
          cout << 1 << " ";
        }
        cout << endl;
      }
    } else {
      for (j = j; j < 46; j++) {
        d = a[j] - m + 1;
        bool q = 0;
        k = 0;
        while (d >= a[k]) {
          if (d == a[k]) {
            q = 1;
          }
          k++;
        }
        if (q == 0) {
          break;
        }
      }
      for (k = 0; k < m; k++) {
        for (l = 0; l < m; l++) {
          if (k == l) {
            cout << d << " ";
          } else {
            cout << 1 << " ";
          }
        }
        cout << endl;
      }
    }
  }
}