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.


import java.io.*;
import java.util.*;

/**
 *  
 * @author akash_2ehuikg
 * Coding is love <3!
 */

public class C {
    public static void main(String args[]) {
        try {
            int n=nextInt();
            if(n==1){
                bw.write("YES\n");
                bw.write(nextInt()+"\n");
                bw.flush();
            }else
            if(n%2==0){
                TreeMap<Integer,Integer> freq=new TreeMap<>();
                for (int i = 0; i < n*n; i++) {
                    int a=nextInt();
                    if(freq.containsKey(a))
                        freq.put(a, freq.get(a)+1);
                    else
                        freq.put(a, 1);
                }
                int flag=0;
                for(int i:freq.keySet()){
                    if(freq.get(i)%4!=0){
                        flag=1;
                        break;
                    }
                }
                
                if(flag==0){
                    int mat[][]=new int[n][n];
                    int key=freq.firstKey();
                    for (int i = 0; i < n/2; i++) {
                        for (int j = 0; j < n/2; j++) {
                            mat[i][j]=key;
                            mat[i][n-j-1]=key;
                            mat[n-i-1][j]=key;
                            mat[n-i-1][n-j-1]=key;
                            
                            freq.put(key, freq.get(key)-4);
                            if(freq.get(key)==0){
                                freq.remove(key);
                                
                                if(!freq.isEmpty())key=freq.firstKey();
                            }
                        }
                    }
                    bw.write("YES\n");
                    for (int i = 0; i < n; i++) {
                        for (int j = 0; j < n; j++) {
                            bw.write(mat[i][j]+" ");
                        }
                        bw.write("\n");
                    }
                    bw.flush();
                }else{
                    bw.write("NO\n");
                    bw.flush();
                }
            }else{
                TreeMap<Integer,Integer> freq=new TreeMap<>();
                for (int i = 0; i < n*n; i++) {
                    int a=nextInt();
                    if(freq.containsKey(a))
                        freq.put(a, freq.get(a)+1);
                    else
                        freq.put(a, 1);
                }
                int flag=0;
                int count=0;
                int oc=0;
                for(int i:freq.keySet()){
                    if(freq.get(i)>=4){
                        count+=freq.get(i)/4;
                    }
                }
                
                if(count<((n-1)*(n-1))/4){
                    flag=1;
                }
                count=0;
                for(int i:freq.keySet()){
                    if(freq.get(i) >=2){
                        count+=freq.get(i)/2;
                    }
                }
                
                if(count<(((n/2 +1)*(n/2 +1))-1)){
                    flag=1;
                }
                
                for(int i:freq.keySet()){
                    if(freq.get(i)%2!=0 ){
                        oc++;
                    }
                }
                
                if(oc>1)
                    flag=1;
                
//                System.out.println(""+freq);
                if(flag==0){
                    int mat[][]=new int[n+1][n+1];
                    int key=0;
                    for (int i :freq.keySet()) {
                        if(freq.get(i)>=4){
                            key=i;
                            break;
                        }
                    }
                    for (int i = 1; i <= n/2; i++) {
                        for (int j = 1; j <= n/2; j++) {
                            mat[i][j]=key;
                            mat[i][n-j+1]=key;
                            mat[n-i+1][j]=key;
                            mat[n-i+1][n-j+1]=key;
                            
                            freq.put(key, freq.get(key)-4);
                            
                            if(freq.get(key)==0){
                                freq.remove(key);
                                int f1=0;
                                for (int k :freq.keySet()) {
                                    if(freq.get(k)>=4){
                                        key=k;
                                        f1=1;
                                        break;
                                    }
                                }
                                
                                if(f1==0 && !(i==n/2 && j==n/2)){
                                    bw.write("NO\n");
                                    bw.flush();
                                    
                                    System.exit(0);
                                }
                            }else if(freq.get(key)<4 && !(i==n/2 && j==n/2)){
                                int f1=0;
                                for (int k :freq.keySet()) {
                                    if(freq.get(k)>=4){
                                        key=k;
                                        f1=1;
                                        break;
                                    }
                                }
                                
                                if(f1==0 && !(i==n/2 && j==n/2)){
                                    bw.write("NO\n");
                                    bw.flush();
                                    
                                    System.exit(0);
                                }
                            }
                            
                        }
                    }
                    int f1=0;
                    for (int i :freq.keySet()) {
                        if( freq.get(i)>=2){
                            key=i;
                            f1=1;
                            break;
                        }
                    }
                    if(f1==0){
                                    bw.write("NO\n");
                                    bw.flush();
                                    System.exit(0);
                                }
                    for (int i = 1; i <= n/2; i++) {
                        mat[n/2 +1][i]=key;
                        mat[n/2 +1][n-i+1]=key;
                        
                        freq.put(key, freq.get(key)-2);
                        if(freq.get(key)==0){
                            freq.remove(key);
                            f1=0;
                            for (int k :freq.keySet()) {
                                if( freq.get(k)>=2){
                                    key=k;
                                    f1=1;
                                    break;
                                }
                            }
                            if(f1==0 && i!=n/2){
                                
                                    bw.write("NO\n");
                                    bw.flush();
                                    System.exit(0);
                                }
                        }else if(freq.get(key)<2 && i!=n/2){
                            f1=0;
                            for (int k :freq.keySet()) {
                                if( freq.get(k)>=2){
                                    key=k;
                                    f1=1;
                                    break;
                                }
                            }
                            if(f1==0 && i!=n/2){
                                
                                    bw.write("NO\n");
                                    bw.flush();
                                    System.exit(0);
                                }
                        }
                    }
                    f1=0;
                    for (int i :freq.keySet()) {
                        if( freq.get(i)>=2){
                            key=i;
                            f1=1;
                            break;
                        }
                    }
                    if(f1==0){
                        
                                    bw.write("NO\n");
                                    bw.flush();
                                    System.exit(0);
                                }
                    for (int i = 1; i <= n/2; i++) {
                        mat[i][n/2 +1]=key;
                        mat[n-i+1][n/2 +1]=key;
                        
                        freq.put(key, freq.get(key)-2);
                        if(freq.get(key)==0){
                            freq.remove(key);
                            f1=0;
                            for (int k :freq.keySet()) {
                                if( freq.get(k)>=2){
                                    key=k;
                                    f1=1;
                                    break;
                                }
                            }
                            
                            if(f1==0 && i!=n/2){
                                
                                    bw.write("NO\n");
                                    bw.flush();
                                    System.exit(0);
                            }
                        }else if(freq.get(key)<2 && i!=n/2){
                            f1=0;
                            for (int k :freq.keySet()) {
                                if( freq.get(k)>=2){
                                    key=k;
                                    f1=1;
                                    break;
                                }
                            }
                            if(f1==0 && i!=n/2){
                                
                                    bw.write("NO\n");
                                    bw.flush();
                                    System.exit(0);
                                }
                        }
                    }
                    
                    key=freq.firstKey();
                    mat[n/2 +1][n/2 + 1]=key;
                    
                    
                    
                     for (int i = 1; i <= n/2; i++) {
                        for (int j = 1; j <= n/2; j++) {
                            if(mat[i][n-j+1]!= mat[i][j] || mat[n-i+1][j]!= mat[i][j] ||  mat[n-i+1][n-j+1]!= mat[i][j]){
                                flag=1;
                            }
                        }
                    }
                     
                     for (int i = 1; i <= n/2; i++) {
                        if(mat[n/2 +1][i]!= mat[n/2 +1][n-i+1] ||   mat[i][n/2 +1]!=mat[n-i+1][n/2 +1]){
                            flag=1;
                        }
                    }
                    if(flag==1)
                        bw.write("NO\n");
                    else{
                    bw.write("YES\n");
                    for (int i = 1; i <= n; i++) {
                        for (int j = 1; j <= n; j++) {
                            bw.write(mat[i][j]+" ");
                        }
                        bw.write("\n");
                    }
                    }
                    bw.flush();
                }else{
                    bw.write("NO\n");
                    bw.flush();
                }
            }
        } catch (Exception e) {
            System.out.println("NO");
        }
    }


    //TEMPLATE
    
    //******************************************************************************
    // Fast I/O 
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
    static StringTokenizer st = null;
    static int mod=1000000007;
    static boolean prime[]=new boolean[10000001];

    static String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    
    static int nextInt() {
        return Integer.parseInt(next());
    }
    
    static long nextLong() {
        return Long.parseLong(next());
    }

    static double nextDouble() {
        return Double.parseDouble(next());
    }

    static int b_search(int l,int r,int A[],int key){
        int ans=0;
        l=0;r=1000000000;

        while(l<r){
            //System.out.println(ans);
            ans=(l+r)/2;
            long temp=0;
            for (int i = 0; i < A.length; i++) {
                temp+=(long)Math.ceil((double)A[i]/(double)ans);
            }

            if(temp<=key){
                r=ans;
            }
            else{
                l=ans+1;
                ans=r;
            }
        }

        return ans;
    }

//******************************************************************************
//Sieve
static void sieveOfEratosthenes(boolean prime[]){
        int n=10000000;
        for(int i=0;i<n;i++) 
            prime[i] = true; 
          
        for(int p = 2; p*p <=n; p++){ 
            if(prime[p] == true) 
            {
                for(int i = p*p; i <= n; i += p) 
                    prime[i] = false; 
            } 
        } 
    } 

//******************************************************************************
//Modulo and FastExpo
    static long modInverse(long a)
    {
       return power(a, mod - 2,mod);
    }
     
    // To compute x^y under modulo m
    static long power(long x, long y, int p)
    {
        // Initialize result
        long res = 1;     
        // Update x if it is more  
        // than or equal to p
        x = x % p; 
     while (y > 0)
        {
            // If y is odd, multiply x
            // with result
            if((y & 1)==1)
                res = (res * x) % p;
            // y must be even now
            // y = y / 2
            y = y >> 1; 
            x = (x * x) % p; 
        }
        return res;
    }
//******************************************************************************
//GCD
    static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
         
        return gcd(b%a, a);
    }

    //******************************************************************************
    // Useful user datatype
    
    static class Pair{
        public long x;
        public long y;

        public Pair(long first, long second){
            this.x = first;
            this.y = second;
            }
        @Override
        public String toString() {
        return "(" + x + "," + y + ")";
        }
    }

    static Comparator csort=new Comparator<Pair>(){
                    public int compare(Pair a, Pair b) {
                        if(a.x < b.x)
                        return -1;
                        else if (a.x > b.x)
                        return 1;
                        else if(a.y < b.y)
                        return -1;
                        else if (a.y > b.y)
                        return 1;
                        else
                        return 0;
                    }
                };

    //******************************************************************************
    //N choose K
    public static long choose(long total, long choose){
        if(total < choose)
            return 0;
        if(choose == 0 || choose == total)
            return 1;
        return choose(total-1,choose-1)+choose(total-1,choose);
    }

    //******************************************************************************
    //Permutations
    // simply prints all permutation - to see how it works
    private static void printPermutations( Comparable[] c ) {
            System.out.println( Arrays.toString( c ) );
            while ( ( c = nextPermutation( c ) ) != null ) {
                    System.out.println( Arrays.toString( c ) );
            }
    }

    // modifies c to next permutation or returns null if such permutation does not exist
    private static Comparable[] nextPermutation( final Comparable[] c ) {
            // 1. finds the largest k, that c[k] < c[k+1]
            int first = getFirst( c );
            if ( first == -1 ) return null; // no greater permutation
            // 2. find last index toSwap, that c[k] < c[toSwap]
            int toSwap = c.length - 1;
            while ( c[ first ].compareTo( c[ toSwap ] ) >= 0 )
                    --toSwap;
            // 3. swap elements with indexes first and last
            swap( c, first++, toSwap );
            // 4. reverse sequence from k+1 to n (inclusive) 
            toSwap = c.length - 1;
            while ( first < toSwap )
                    swap( c, first++, toSwap-- );
            return c;
    }

    // finds the largest k, that c[k] < c[k+1]
    // if no such k exists (there is not greater permutation), return -1
    private static int getFirst( final Comparable[] c ) {
            for ( int i = c.length - 2; i >= 0; --i )
                    if ( c[ i ].compareTo( c[ i + 1 ] ) < 0 )
                            return i;
            return -1;
    }

    // swaps two elements (with indexes i and j) in array 
    private static void swap( final Comparable[] c, final int i, final int j ) {
            final Comparable tmp = c[ i ];
            c[ i ] = c[ j ];
            c[ j ] = tmp;
    }
    //******************************************************************************
    // DSU
    //Maintain an Array A with N elements and Array size for size of each set, intialize A[i]=i and size[i]=1

    static int root(int A[],int i){
        while(A[i]!=i){
            A[i]=A[A[i]];
            i=A[i];
        }
        return i;
    }

    static boolean find(int A[],int a,int b){
        if(root(A,a)==root(A,b))return true;
        else return false;
    }

    static void union(int A[],int size[],int a,int b){
        int ra=root(A,a);
        int rb=root(A,b);

        if(ra==rb)return;

        if(size[ra]<size[rb]){
            A[ra]=A[rb];
            size[rb]+=size[ra];
        }else{
            A[rb]=A[ra];
            size[ra]+=size[rb];
        }
    }

    //**************************************************************************
    //BinarySearch
    /* binary search for 5:
                v-- lower bound
         1 2 3 4 5 5 5 6 7 9
                      ^-- upper bound
        
            binary search for 8
                        v-- lower bound
       1 2 3 4 5 5 5 6 7 9
                        ^-- upper bound
    */
    //For finding greater than 
    static int upper_bound(int A[],int key){
        int first = 0;
        int last = A.length;
        int mid;

        while (first < last) {
            mid =first+(last - first)/2; 

            if (A[mid] <= key)  
                first = mid + 1; 
            else 
                last = mid;
        }

        return first;
    }
    
    //For finding greater than equal to
    static int lower_bound(int A[],int key){
        int first = 0;
        int last = A.length;
        int mid=0;
        
        while (first < last) {
            mid = first + ((last - first) >> 1); 
            if (A[mid] < key)  
                first = mid + 1; 
            else 
                last = mid;
        }
        
        return first;
    }
    //**************************************************************************
}
