Problem: Let's call some square matrix with integer values in its cells palindromic if it doesn't change after the order of rows is reversed and it doesn't change after the order of columns is reversed.

For example, the following matrices are palindromic:

<image>

The following matrices are not palindromic because they change after the order of rows is reversed:

<image>

The following matrices are not palindromic because they change after the order of columns is reversed:

<image>

You are given n^2 integers. Put them into a matrix of n rows and n columns so that each number is used exactly once, each cell contains exactly one number and the resulting matrix is palindromic. If there are multiple answers, print any. If there is no solution, print "NO".

Input

The first line contains one integer n (1 ≤ n ≤ 20).

The second line contains n^2 integers a_1, a_2, ..., a_{n^2} (1 ≤ a_i ≤ 1000) — the numbers to put into a matrix of n rows and n columns.

Output

If it is possible to put all of the n^2 numbers into a matrix of n rows and n columns so that each number is used exactly once, each cell contains exactly one number and the resulting matrix is palindromic, then print "YES". Then print n lines with n space-separated numbers — the resulting matrix.

If it's impossible to construct any matrix, then print "NO".

You can print each letter in any case (upper or lower). For example, "YeS", "no" and "yES" are all acceptable.

Examples

Input


4
1 8 8 1 2 2 2 2 2 2 2 2 1 8 8 1


Output


YES
1 2 2 1
8 2 2 8
8 2 2 8
1 2 2 1


Input


3
1 1 1 1 1 3 3 3 3


Output


YES
1 3 1
3 1 3
1 3 1


Input


4
1 2 1 9 8 4 3 8 8 3 4 8 9 2 1 1


Output


NO


Input


1
10


Output


YES
10 

Note

Note that there exist multiple answers for the first two examples.

Solution (in JAVA):

Solution:
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class V1Q3 {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        if(n==1){
            int num=s.nextInt();
            System.out.println("YES");
            System.out.println(num);
            return;
        }
        int[][] matrix;
        Map<Integer,Integer> freq=new HashMap<>();
        for (int i = 0; i <n*n ; i++) {
            int num=s.nextInt();
            if(freq.keySet().contains(num)){
                freq.put(num,freq.get(num)+1);
            }
            else{
                freq.put(num,1);
            }
        }
        if(n%2==0){
            matrix=new int[n/2][n/2];
            int filled=0;
            for (int num:freq.keySet()) {
                if(freq.get(num)%4!=0){
                    System.out.println("NO");
                    return;
                }
                else{
                    int count=freq.get(num)/4;
                    for (int i = filled; i <filled+count ; i++) {
                        int row=i/(n/2);
                        int col=i%(n/2);
                        matrix[row][col]=num;
                    }
                    filled+=count;
                }
            }
            System.out.println("YES");
//            for (int i = 0; i <n/2 ; i++) {
//                System.out.println(Arrays.toString(matrix[i]));
//            }
            printBoard(matrix,n);
        }
        else{
            matrix=new int[n/2+1][n/2+1];
            int set4=(n*n+1-2*n)/4;
            int filled4=0;
            int set2=n-1;
            int filled2=0;
            int set1=1;
            for (int num:freq.keySet()) {
                int f=freq.get(num);
                int tset4=f/4;
                int tset2=(f%4)/2;
                if(f%2!=0){
                    set1--;
                    matrix[n/2][n/2]=num;
                    if(set1<0){
                        System.out.println("NO");
                        return;
                    }
                    if(f==1){
                        continue;
                    }
                }
                if(set4!=0){
                    int temp=set4;
                    int temp2=tset4;
                    set4=tset4<=set4?set4-tset4:0;
                    tset4=tset4<=temp?0:tset4-temp;
                    int count=temp2-tset4;
                    for (int i = filled4; i <filled4+count ; i++) {
                        int row=i/(n/2);
                        int col=i%(n/2);
                        matrix[row][col]=num;
                    }
                    filled4+=count;
                }
                if(tset4!=0) {
                    tset2 += 2 * tset4;
                }
                if(set2<tset2){
                    System.out.println("NO");
                    return;
                }
                else{
                    int temp=set2;
                    set2-=tset2;
                    int count=temp-set2;
                    for (int i = filled2; i <filled2+count ; i++) {
                        int row=i;
                        int col=n/2;
                        if(i>=n/2){
                            row=n/2;
                            col=i%(n/2);
                        }
                        matrix[row][col]=num;
                    }
                    filled2+=count;
                }
            }
            System.out.println("YES");
            // for (int i = 0; i <n/2+1 ; i++) {
            //     System.out.println(Arrays.toString(matrix[i]));
            // }
            printBoard(matrix,n);
        }
    }

    private static void printBoard(int[][] matrix,int n) {
        for (int i = 0; i <n ; i++) {
            int i1=i;
            if(i>=n/2){
                i1=n-(i+1);
            }
            for (int j = 0; j <n ; j++) {
                int j1=j;
                if(j>=n/2){
                    j1=n-(j+1);
                }
                System.out.print(matrix[i1][j1]+" ");
            }
            System.out.println();
        }
    }
}