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 ("O3")
// #pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

#define int long long int

#define vi vector<int>
 
#define ff first
#define ss second
 
#define pb push_back
#define MOD 1000000007
//const int nax = 1e6+5;
#define inf 4e18
#define Graph vector<vi>
#define Graphw vector<vector<pair<int,int>>> 
#define sz(x) (int)x.size()
#define pr pair<int,int>
 
#define display(v) for(int i =0;i<(int)v.size();++i)cout << v[i] << " "
#define all(v) v.begin(),v.end()
#define read(a) for(int i = 0;i<(int)a.size();++i)cin>>a[i]
#define show(x) cout << #x << " is " << x << "\n";
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_si;
// typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_msi;
#define show_arr(a) cout << #a << "\n"; display(a) ; cout << "\n";
inline int add(int a, int b){ int c = (a%MOD) + (b%MOD); if(c >= MOD) c -= MOD; return c; }
inline int mul(int a, int b){ return ((a%MOD) * 1ll * (b%MOD)) % MOD; }
inline int sub(int a, int b){ int c = (a%MOD) - (b%MOD); if(c < 0) c += MOD; return c; }
inline int sum_till(int n) { return mul(mul(n, n + 1), (MOD + 1) / 2); }
const int nax = 300*1000 + 10;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//#define ook order_of_key
//#define fbo find_by_order
//   order_of_key(x) -> number of elements less than x.
// * find_by_order(x) -> gives the element at index x (0 - indexing)

void test_case();
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1; cin>>t;
    while(t--){
        test_case();
    }
    return 0;
}

void test_case(){
    int n; cin>>n;
	if(n == 1){
		cout << 1 << '\n';
		return;
	}
	if(n == 2){
		cout << -1 << '\n';
		return;
	}
	int a[n][n];
	int cur = 1;
	for(int i =0 ;i < n ; ++i){
		for(int j = 0 ; j < n ; ++j){
			if((i + j)%2 == 0){
				a[i][j] = cur++;
			}
		}
	}
	for(int i =0 ;i < n ; ++i){
		for(int j = 0 ; j < n ; ++j){
			if((i + j)%2 == 1){
				a[i][j] = cur++;
			}
		}
	}
	for(int i = 0; i <n ; ++i){
		for(int j = 0 ; j < n ; ++j){
			cout << a[i][j] << ' ';
		}
		cout << '\n';
	}
	
}    

// Химаншу
// check overflow
// special case n == 1
// 🍪🍪🍪