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.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class Cf131 implements Runnable 
{
    static class InputReader 
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) 
        {
            this.stream = stream;
        }
        
        public int read()
        {
            if (numChars==-1) 
                throw new InputMismatchException();
            
            if (curChar >= numChars) 
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                
                if(numChars <= 0)               
                    return -1;
            }
            return buf[curChar++];
        }
    
        public String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }    
            return str;
        }
        public int nextInt() 
        {
            int c = read();
            
            while(isSpaceChar(c)) 
                c = read();
        
            int sgn = 1;
        
            if (c == '-') 
            {
                sgn = -1;
                c = read();
            }
            
            int res = 0;
            do
            {
                if(c<'0'||c>'9') 
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c)); 
        
            return res * sgn;
        }
        
        public long nextLong() 
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;
            
            do 
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }    
            while (!isSpaceChar(c));
                return res * sgn;
        }
        
        public double nextDouble() 
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') 
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') 
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
    
        public String readString() 
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do 
            {
                res.appendCodePoint(c);
                c = read();
            } 
            while (!isSpaceChar(c));
            
            return res.toString();
        }
    
        public boolean isSpaceChar(int c) 
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    
        public String next()
        {
            return readString();
        }
        
        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception 
    {
        new Thread(null, new Cf131(),"Main",1<<27).start();
    }
    
    static class Pair{
        int nod;
        int ucn;
        
        
        Pair(int nod,int ucn){
            this.nod=nod;
            this.ucn=ucn;
            
        }
        
    public static Comparator<Pair> wc = new Comparator<Pair>(){
        public int compare(Pair e1,Pair e2){
            
            //reverse order
            if (e1.ucn < e2.ucn) 
                return 1;  // 1 for swaping.
            else if (e1.ucn > e2.ucn) 
                return -1; 
            else{
                // if(e1.siz>e2.siz)
                //     return 1;
                // else
                //     return -1;
                return 0;
            } 
        }
    };	
    }

    public static long gcd(long a,long b){
        if(b==0)return a;
        else return gcd(b,a%b);
    }


    ////recursive BFS
    public static int bfsr(int s,ArrayList<Integer>[] a,int[] dist,boolean[] b,int[] pre){
        b[s]=true;
        int p = 0;
        int t = a[s].size();
        for(int i=0;i<t;i++){
            int x = a[s].get(i);
            if(!b[x]){
                dist[x] = dist[s] + 1;
                p+= (bfsr(x,a,dist,b,pre)+1);
            }
        }
        pre[s] = p;
        return p;
    }

//// iterative BFS
    public static int bfs(int s,ArrayList<Integer>[] a,int[] dist,boolean[] b,PrintWriter w){
        b[s]=true;
        int siz = 0;
        
        Queue<Integer> q = new LinkedList<>();
        q.add(s);
        while(q.size()!=0){
            int i=q.poll();
        //    w.println(" #"+i+"# ");
            Iterator<Integer> it =a[i].listIterator();
            int z=0;
            while(it.hasNext()){
                z=it.next();
               // w.println("#"+i+" "+z);
                if(!b[z]){
                //    w.println("* "+z+" *");
                    b[z]=true;
                    dist[z] = dist[i] + 1;
                 //   w.print("*");
                   // w.println(i+" "+z);
                    siz++;
                //    x.add(z);
                //    w.println("@ "+x.get(x.size()-1)+" @");
                    q.add(z);
                }
            }   
        
        }
        return siz;
    }







//////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////


    public void run()
    {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        
       

        // int t = sc.nextInt();
        // while(t-->0){
        
            int n  = sc.nextInt();
            
            int[] c = new int[1001];
            int[] a = new int[n*n];
            Queue<Integer> four = new LinkedList<Integer>();
            Queue<Integer> two  = new LinkedList<Integer>();
            int one = 0;
            for(int i=0;i<n*n;i++){
                a[i] = sc.nextInt();
                c[a[i]]++;
            }
            boolean f = true;
            for(int i=0;i<n*n;i++){
             //   w.print("#"+c[a[i]]+" ");
                if(c[a[i]]>=4){four.add(a[i]);c[a[i]]-=4;}
                else if(c[a[i]]>=2){two.add(a[i]);c[a[i]]-=2;}
                else if(c[a[i]]==1){one = a[i];c[a[i]]=0;}
                
            }
            
           // w.println();
            int[][] ans = new int[n][n];
            int x = (n/2)*(n/2);
            int y = (n%2)*(n/2)*2;
            int z = (n%2);
            while(four.size()>x){
                int tt = four.poll();
                two.add(tt);two.add(tt);
            }
            if(four.size()<x || two.size()<y || one<z)f = false;
            // w.println("*"+x+" "+y+" "+z);
            // w.println("*"+four.size()+" "+two.size()+" "+one);
            if(f){
                w.println("YES");
                for(int i=0;i<n/2;i++){
                    for(int j=0;j<n/2;j++){
                        int temp = four.poll();
                        ans[i][j] = temp;
                        ans[n-1-i][j] = temp;
                        ans[i][n-1-j] = temp;
                        ans[n-1-i][n-1-j] = temp;
                    }
                }
                if(z==1){
                    ans[n/2][n/2] = one;
                    for(int i=0;i<n/2;i++){
                        int temp1 = two.poll();
                        int temp2 = two.poll();
                        ans[i][n/2] = temp1;
                        ans[n-1-i][n/2] = temp1;
                        ans[n/2][i] = temp2;
                        ans[n/2][n-1-i] = temp2;
                        
                    }
                   
                }
                for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        w.print(ans[i][j]+" ");
                    }
                    w.println();
                }

            }
            else w.println("NO");


            
           
        //}    
        w.flush();
        w.close();



        
        
    }

}