Problem: We will consider the numbers a and b as adjacent if they differ by exactly one, that is, |a-b|=1.

We will consider cells of a square matrix n × n as adjacent if they have a common side, that is, for cell (r, c) cells (r, c-1), (r, c+1), (r-1, c) and (r+1, c) are adjacent to it.

For a given number n, construct a square matrix n × n such that: 

  * Each integer from 1 to n^2 occurs in this matrix exactly once; 
  * If (r_1, c_1) and (r_2, c_2) are adjacent cells, then the numbers written in them must not be adjacent. 

Input

The first line contains one integer t (1 ≤ t ≤ 100). Then t test cases follow.

Each test case is characterized by one integer n (1 ≤ n ≤ 100).

Output

For each test case, output: 

  * -1, if the required matrix does not exist; 
  * the required matrix, otherwise (any such matrix if many of them exist). 



The matrix should be outputted as n lines, where each line contains n integers.

Example

Input


3
1
2
3


Output


1
-1
2 9 7
4 6 3
1 8 5

Solution (in CPP):

Solution:
//
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
//
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define pb push_back
#define bp pop_back
#define int long long int
#define vt vector
#define pii pair<int,int>
#define pq priority_queue
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define FOR(i, a, b) for (int i=a; i<(b); ++i)
#define F0R(i, a) for (int i=0; i<(a); ++i)
#define um unordered_map
#define us unordered_set
#define bs binary_search
#define endl '\n'

int M = 1e9 + 7;
const int N = 10000002;
int spf[N];

void sieve() {
    FOR(i, 1, N) spf[i] = i;
    for (int i = 2; i * i < N; ++i) {
        if (spf[i] == i) {
            for (int j = i * i; j < N; j += i)
            {
                if (spf[j] == j)
                    spf[j] = i;
            }
        }
    }
}

int mpower(int x, unsigned int y) {
    int res = 1;
    x = x % M;
    if (x == 0) return 0;
    while (y)
    {
        if (y & 1)
            res = (res * x) % M;
        y = y >> 1;
        x = (x * x) % M;
    }
    return res;
}
int gcdExtended(int a, int b, int *x, int *y);

int modInverse(int b, int m) {
    int x, y;
    int g = gcdExtended(b, m, &x, &y);
    if (g != 1)
        return -1;
    return (x % m + m) % m;
}

int gcdExtended(int a, int b, int *x, int *y) {
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }
    int x1, y1;
    int gcd = gcdExtended(b % a, a, &x1, &y1);
    *x = y1 - (b / a) * x1;
    *y = x1;
    return gcd;
}

void solve();

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    // sieve();
    int t;
    cin >> t;
    while (t--)
        solve();
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////

void solve() {
    int n;
    cin >> n;
    vector<vector<int>> ans(n, vector<int>(n, 0));
    if (n == 1)
        cout << 1 << endl;
    else if (n == 2)
        cout << -1 << endl;
    else {
        int c = 0, cnt = 1;
        while (c < n * n) {
            int i = c / n, j = c % n;
            ans[i][j] = cnt;
            ++cnt;
            c += 2;
        }
        c = 1;
        while (c < n * n) {
            int i = c / n, j = c % n;
            ans[i][j] = cnt;
            ++cnt;
            c += 2;
        }
        for (auto i : ans) {
            for (auto j : i)
                cout << j << " ";
            cout << endl;
        }
    }

}