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:
#include <bits/stdc++.h>
#define ll long long int
#define loop(i,n) for(ll i=0;i<n;i++)
#define mod cons long long 1e9+ 7
#define first ff
#define second ss
#define vec vector<ll>
#define mm map<ll,ll>
#define mmv map<ll,vec>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

void Sieve_of_Eratosthenes()
{

    const long long MAX_SIZE = 1000001;
    vector<long long >isprime(MAX_SIZE , true); 
    vector<long long >prime; 
    vector<long long >SPF(MAX_SIZE); 
    int N=1000000,pr[1000000],k=0;
    isprime[0] = isprime[1] = false ; 
    for (long long int i=2; i<N ; i++) 
    { 
        if (isprime[i]) { 
            prime.push_back(i); 
            SPF[i] = i; 
        } 
        for (long long int j=0; j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i]; j++) { 
            isprime[i*prime[j]]=false; 
            SPF[i*prime[j]] = prime[j] ; 
        } 
    } 
    for (long long int i=0; i<prime.size() && prime[i] <= N ; i++) {
        pr[k]=prime[i];
        k++;
    }
}
ll max(ll a, ll b)
{
    if(a>=b)
        return a;
    else
        return b;
}
ll min(ll a, ll b)
{
    if(a<=b)
        return a;
    else
        return b;
}
int palin(string s)
{
    int n=s.length();
    for(int i=0;i<=n/2;i++)
    {
        if(s[i]!=s[n-i])
            return 0;
    }
    return 1;
}
//replacing character at a givne index
string crep(string s, string a, int i)
{
    s.replace(i,i+1,a);
    return s;
}
//replacing multiple charcter with a given char
string mcrep(string s, string a, int i,int j)
{
    string s1="";
    for(int i=0;i<j;i++)
    {
        s1=s1+a;
    }
    s.replace(i,j,s1);
    return s;
}
ll icount(ll arr[], ll n, ll num)
{
    ll k=0;
    loop(i,n)
    {
        if(arr[i]==num)
            k++;
    }
    return k;
}
ll ccount(string s,char a)
{
    ll k,a1=0;
    k=s.length();
    loop(i,k)
    {
        if(s[i]==a)
            a1++;
    }
    return a1;
}
void solve()
{
        ll n;
        cin>>n;
        ll c=n+1;
        ll a[n][n];
        if(n==2)
            cout<<"-1\n";
        else
        {
            loop(i,n)
            {
                loop(j,n)
                    a[i][j]=0;
            }
            for(ll i=0;i<n;i++)
            {
                for(ll j=0;j<n;j++)
                {
                    if(a[i][j]!=0)
                        continue;
                    if(i==j)
                        a[i][j]=i+1;
                    else
                    {
                        a[i][j]=c;
                        a[j][i]=c+1;
                        c+=2;
                    }
                }
            }
            loop(i,n)
            {
                loop(j,n)
                {
                    cout<<a[i][j]<<" ";
                }
                cout<<"\n";
            }
        }
}
int main()
{  
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    fast
    int test;
    cin>>test;
    while(test-->0)
        solve();
}