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.io.*;
import java.util.*;

public class Solution{
    public static void main(String[] args){
        try {
            PrintWriter out=new PrintWriter(System.out,true);
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            int n = Integer.parseInt(br.readLine());
            String[] ss = br.readLine().split(" ");
            int[] arr = new int[n*n];
            int[] c = new int[1001];
            for(int j=0;j<n*n;j++){
                arr[j]=Integer.parseInt(ss[j]);
                c[arr[j]]+=1;
            }
            if(n==1){
                out.println("YES");
                out.println(arr[0]);
            }else{

                boolean ff =false;
                int p=1;
                int[][] grid = new int[n][n];
                for(int j=0;j<n/2;j++){
                    for(int k=0;k<n/2;k++) {
                        while (p<=1000 && c[p] < 4) {
                            p++;
                        }
                        if(p>1000){
                            ff=true;
                            break;
                        }
                        grid[j][k]=p;
                        c[p]-=4;
                    }
                }
                for(int j=0;j<n/2;j++){
                    for(int k=0;k<n/2;k++){
                        grid[n-1-j][n-1-k]=grid[j][k];
                        grid[n-1-j][k]=grid[j][k];
                        grid[j][n-1-k]=grid[j][k];
                    }
                }
                if(n%2==0){
                    if(ff){
                        out.println("NO");
                    }else{
                        out.println("YES");
                        for(int j=0;j<n;j++){
                            StringBuilder str = new StringBuilder("");
                            for(int k=0;k<n;k++){
                                str.append(grid[j][k]).append(" ");
                            }
                            out.println(str);
                        }
                    }
                }else{
                    if(ff){
                        out.println("NO");
                    }else{
                        p=1;
                        for(int j=0;j<n/2;j++){
                            while(p<=1000 && c[p]<2){
                                p++;
                            }
                            if(p>1000){
                                ff=true;
                                break;
                            }
                            c[p]-=2;
                            grid[n/2][j]=p;
                            grid[n/2][n-1-j]=p;
                        }
                        for(int k=0;k<n/2;k++){
                            while(p<=1000 && c[p]<2){
                                p++;
                            }
                            if(p>1000){
                                ff=true;
                                break;
                            }
                            c[p]-=2;
                            grid[k][n/2]=p;
                            grid[n-1-k][n/2]=p;
                        }
                        if(ff){
                            out.println("NO");
                            return;
                        }
                        for(int j=1;j<=1000;j++){
                            if(c[j]==1){
                                ff=true;
                                grid[n/2][n/2]=j;
                                c[p]-=1;
                                break;
                            }
                        }

                        if(!ff){
                            out.println("NO");
                        }else{
                            out.println("YES");
                            for(int j=0;j<n;j++){
                                StringBuilder str = new StringBuilder("");
                                for(int k=0;k<n;k++){
                                    str.append(grid[j][k]).append(" ");
                                }
                                out.println(str);
                            }

                        }

                    }
                }
            }


            out.close();
        } catch (Exception e) {
            System.out.println("kkkk "+ e.getMessage());
        }
    }




    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static int lcm(int a,int b){
        long c=a*b;
        return (int)(c/hcf(a,b));
    }
    static int hcf(int a,int b){
        if(a==0){
            return b;
        }
        if(b==0){
            return a;
        }
        if(a>b)
            return hcf(a%b,b);

        return hcf(a,b%a);
    }

    static int modInverse(int x,int m){
        return power(x,m-2,m);
    }
    static int power(int x, int y, int m)
    {
        if (y == 0)
            return 1;

        long p = power(x, y / 2, m) % m;
        p = (p * p) % m;

        return (int)((y%2==0)? p : (x*p)%m);
    }
    static class pair{
        int a,b;
        public pair(int a,int b){
            this.a=a;
            this.b=b;
        }
    }
}