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<iostream>
#include <stdlib.h>
#include<math.h>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include<list>
#include<stack>
#include<map>
#include<deque>
#include<string>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include <iomanip>
typedef long long ll;
typedef unsigned long long ull;
typedef double  dou;
typedef long double ld;
typedef  int I;
using namespace std;
#define  E endl
/*
_  _  _  _  _ _
|               \    |`\              /`|
|      /`\       \   |  \   ------   /  |
|     /   \      /   |   \  \    /  /   |
|     \_ _/     /    |    \  \  /  /    |
|              /     |     \  \/  /     |
|             /      |      \    /      |
|             \      |  |`\  \  /  /`|  |
|     /``\     \     |  |  \  \/  /  |  |
|    /    \     \    |  |   \____/   |  |
|    \    /      \   |  |            |  |
|     \__/       /   |  |            |  |
|_ _ _ _ _ _ _ _/    |_ |            | _|
*/
void yes()
{
	cout << "YES" << E;
}
void no()
{
	cout << "NO" << E;
}
ll t, mod = 1073741824;
#define loop(a,n) for(ll i=a;i<n;i++)
#define loopj(a,n) for(ll j=a;j<n;j++)
#define loopk(a,n) for(ll k=a;k<n;k++)
#define loopl(a,n) for(int l=a;l<n;l++)
#define loopp(a,n) for(int p=a;p<n;p++)
#define loop_r(a,n) for(int i=n-1;i>=a;i--)
#define loop_Jr(a,n) for(int j=n-1;j>=a;j--)
#define loop_it(m,it) for(it=m.begin();it!=m.end();it++)
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define TC  cin>>t ;while(t--)
#define TC  cin>>t ;while(t--)
ll fast_power(ll x, ll y)
{
	if (y == 0) return 1;
	ll temp = fast_power(x, y / 2);
	//temp%=MOD;
	if (y % 2 != 0) temp = (temp*temp*x);
	else temp = (temp*temp);
	return temp/*%MOD*/;
}
ull gcd(ull a, ull b) {
	return b == 0 ? a : gcd(b, a % b);
}
bool prime(int n)
{
	if (n % 2 == 0 && n != 2)return false;
	if (n == 1)return false;
	if (n == 2)return true;
	for (int i = 3; i*i <= n; i += 2)
	{
		if (n%i == 0)return false;
	}
	return true;
}
ull  prime_factor(ull n)
{
	map<ull,ull>m;
	map<ull, ull>::iterator it;
	while (n % 2 == 0)
	{
			m[2]++;
		n = n / 2;
	}
	for (ull i = 3; i <= sqrt(n); i = i + 2)
	{

		while (n%i == 0)
		{
			m[i]++;
			n = n / i;
		}
	}
	if (n > 2)
		m[n]++;
	ll ans = 1;
	loop_it(m, it){
		ans *= (it->second+1);
	}
	return ans;
}
void turn(ll& a, ll& b, ll q)
{
	ll nxt = a - (q * b);
	a = b;
	b = nxt;
}
ll extended_gcd(ll a, ll b, ll& x0, ll& y0)
{
	//ax+by=c
	//c is must be  gcd(a,b) to find solution
	ll r0 = a, r1 = b;
	ll x1, y1;
	x1 = y0 = 0;
	x0 = y1 = 1;
	while (r1 != 0)
	{
		ll q = r0 / r1;
		turn(x0, x1, q);
		turn(y0, y1, q);
		turn(r0, r1, q);
	}
	return r0;
}
ll arr[101][101];
int main()
{ 
	speed;
	TC
	{
		ll n,c=1;
		cin >> n;
		queue<ll>q;
		loop(1, n*n + 1){
			q.push(i);
		}
		loop(0, n){
			loopj(0, n){
				if (c & 1){
					arr[i][j] = q.front();
					q.pop();
				}
				else arr[i][j] = 0;
				c++;
			}
		}
		bool ye = 1;
		loop(0, n){
			loopj(0, n){
				if (arr[i][j] == 0){
					arr[i][j] = q.front();
					q.pop();
				}
			}
		}


		loop(0, n){
			loopj(0, n){
				if (j + 1 < n){
					if (abs(arr[i][j] - arr[i][j + 1]) == 1){
						ye = 0;
						break;
					}
				}
				if (j - 1 >= 0){
					if (abs(arr[i][j] - arr[i][j - 1]) == 1){
						ye = 0;
						break;
					}
				}
				if (i + 1 < n){
					if (abs(arr[i][j] - arr[i + 1][j]) == 1){
						ye = 0;
						break;
					}
				}
				if (i - 1 >= 0){
					if (abs(arr[i][j] - arr[i - 1][j]) == 1){
						ye = 0;
						break;
					}
				}
			}
		}

		if (!ye)cout << -1 << E;
		else {
			loop(0, n){
				loopj(0,n){
					cout << arr[i][j] << ' ';
				}
				cout << E;
			}
		}
	}
	return 0;
}