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 JAVA):

Solution:

import java.util.*;

public class Example {
    static long[][] dp;
    //  static    int[]  ar;
    static int mod = 1000000000 + 7;
    static long[] ans = new long[100000 + 1];
    static List<List<Integer>> adj;
    static int[] vis;
    static int[] dis;
    static int row;
    static int col;
    static int[] arr;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();


        while (t > 0) {
            t--;
            int n = sc.nextInt();
     if(n==1){
         System.out.println(1);
     }else if(n==2){
         System.out.println(-1);
     }else{
         int a=1;
         int b=2;
         for(int i=1;i<=n;i++){
             for(int j=1;j<=n;j++){
                 if(a<=(n*n)){
                     System.out.print(a+" ");
                 }else{
                     if(b<=(n*n)){
                         System.out.print(b+" ");
                         b=b+2;
                     }
                 }
                 a=a+2;
             }
             System.out.println();
         }
     }


    }
        }





    private static boolean answer(int i, int k) {
        if (k == 0)
            return true;
        if (k < 0)
            return false;
        if (i <= 0)
            return false;
        return answer(i, k - arr[i]) || answer(i - 1, k);
    }


    private static long findans(int[] arr, int i, int s) {
        if (i < 0 && s == 0)
            return 0;
        if (i < 0 && s == 1)
            return 0;
        if (dp[i][s] != -1) {
            return dp[i][s];
        } else {


            if (s == 0)
                return dp[i][s] = Math.max(findans(arr, i - 1, s), -1 * arr[i] + findans(arr, i - 1, 1 - s));
            else
                return dp[i][s] = Math.max(findans(arr, i - 1, s), arr[i] + findans(arr, i - 1, 1 - s));
        }
    }

    public static void dfs(int v, int di) {
        dis[v] = di;
        vis[v] = 1;
        for (int i = 0; i < adj.get(v).size(); i++) {
            int x = adj.get(v).get(i);
            if (vis[x] == 0) {
                dfs(x, di + 1);
            }
        }
    }

    private static boolean isPrime(long a) {
        if (a == 1)
            return true;

        for (int i = 2; i * i <= a; i++) {
            if (a % i == 0)
                return false;

        }
        return true;
    }

    private static int gcd(int aa, int bb) {
        if (bb == 0)
            return aa;
        return gcd(bb, aa % bb);

    }

    private static int lowerBound(int[] ar, int a) {
        int res = 0;
        int s = 1;
        int e = ar.length - 1;
        while (s <= e) {
            int mid = (s) + (e - s) / 2;
            if (ar[mid] <= a) {
                res = mid;
                s = mid + 1;

            } else {
                e = mid - 1;
            }
        }
        return res;
    }

    public static int getXORSum(int[] arr1, int[] arr2) {

        long c = 0;
        int n = arr1.length;
        int m = arr2.length;
        if (n == 1 && m == 1) {
            return arr1[0] & arr2[0];
        }
        int aa = n + m;
        for (int i = 0; i < 32; i++) {

            int z = 0;
            int o = 0;
            int cc = 0;
            for (int a : arr1) {


                int x = (a & (1 << i));
                if (x == 0)
                    z++;
                else
                    o++;


            }
            for (int a : arr2) {
                int x = (a & (1 << i));
                if (x == 0)
                    z++;
                else
                    o++;
            }

            System.out.println(z + " " + o);

            if (z != aa && o != aa) {
                c = c + (1 << i);

            }


        }
        return (int) c;


    }


}