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.*;
import java.io.*;
import java.math.*;
public class Main4
{
    static class Reader 
    { 
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} 
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];} 
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;} 
        public String s(){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 long l(){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 int i(){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 double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } 
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } 
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}
    }
    
    
 
           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

    static int n;
    public static void main(String[] args)throws IOException
    {
        PrintWriter out= new PrintWriter(System.out);
        Reader sc=new Reader();
        n=sc.i();
        int arr[]=sc.arr(n*n);
        HashMap<Integer,Integer> hm=new HashMap();
        for(int i=0;i<n*n;i++)
        hm.put(arr[i],hm.getOrDefault(arr[i],0)+1);
        int ans[][]=new int[n][n];
        int rval=0,cval=0;
        int imp=0;int flag=0;
        if(n%2==0)
        {
            for (int i : hm.keySet()) 
            {
                if(hm.get(i)%4==0)
                {
                    int c=hm.get(i);
                    while(c>0)
                    {
                        c-=4;
                        ans[rval][cval]=i;
                        ans[rval][n-cval-1]=i;
                        ans[n-rval-1][n-cval-1]=i;
                        ans[n-rval-1][cval]=i;
                        if(cval==n/2-1)
                        {
                            rval++;
                            cval=0;
                        }
                        else
                        cval++;
                    }
                }
                else
                {
                    System.out.println("NO");
                    System.exit(0);
                }
            }
        }
        else
        {
            for (int i : hm.keySet()) 
            {
                if(hm.get(i)%4==1||hm.get(i)%4==3)
                {
                    if(ans[n/2][n/2]!=0)
                    {
                        System.out.println("NO");
                        System.exit(0);
                    }
                    ans[n/2][n/2]=i;
                    hm.put(i,hm.get(i)-1);
                }
                if(hm.get(i)%2==0&&hm.get(i)!=0&&hm.get(i)%4!=0)
                {
                    int c=hm.get(i);
                    c-=2;
                    if(flag==0)
                    {
                        ans[imp][n/2]=i;
                        ans[n-imp-1][n/2]=i;
                        imp++;
                        if(imp==n/2)
                        {
                            flag=1;
                            imp=0;
                        }
                    }
                    else
                    {
                        if(imp==n/2)
                        {
                            System.out.println("NO");
                            System.exit(0);
                        }
                        ans[n/2][imp]=i;
                        ans[n/2][n-imp-1]=i;
                        imp++;
                    }
                    hm.put(i,hm.get(i)-2);
                }
                if(hm.get(i)%4==0&&hm.get(i)!=0)
                {
                    int c=hm.get(i);
                    while(c>0)
                    {
                        if(rval==n/2)
                        {
                            c-=2;
                            if(flag==0)
                            {
                                ans[imp][n/2]=i;
                                ans[n-imp-1][n/2]=i;
                                imp++;
                                if(imp==n/2)
                                {
                                    flag=1;
                                    imp=0;
                                }
                            }
                            else
                            {
                                if(imp==n/2)
                                {
                                    System.out.println("NO");
                                    System.exit(0);
                                }
                                ans[n/2][imp]=i;
                                ans[n/2][n-imp-1]=i;
                                imp++;
                            }
                        }
                        else
                        {
                            c-=4;
                            ans[rval][cval]=i;
                            ans[rval][n-cval-1]=i;
                            ans[n-rval-1][n-cval-1]=i;
                            ans[n-rval-1][cval]=i;
                            if(cval==n/2-1)
                            {
                                rval++;
                                cval=0;
                            }
                            else
                            cval++;
                        }
                    }
                }
                if(hm.get(i)!=0&&hm.get(i)%2!=0)
                {
                    System.out.println("NO");
                    System.exit(0);
                }
            }
        }
        out.println("YES");
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<n;j++)
            out.print(ans[i][j]+" ");
            out.println();
        }
        out.flush();
    }
}