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.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;


public class GFG77
{
    static int mod1 = (int) (1e9 + 7);
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
        public String nextString() throws IOException
        {
            String str00=scan.next();
            return str00;
        }
        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do
            {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }

        public int[] nextArray(int n) throws IOException
        {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = nextInt();
            }
            return a;
        }
    }
    static boolean primeCheck(long num0)
    {
        boolean b1 = true;
        if(num0==1)
        {
            b1=false;
        }
        else
        {
            int num01 = (int) (Math.sqrt(num0)) + 1;
            me1: for (int i = 2; i < num01; i++)
            {
                if (num0 % i == 0)
                {
                    b1 = false;
                    break me1;
                }
            }
        }
        return b1;
    }
    static int[][] primeDivisor(int pos0,int[][] arr0,int num0)
    {
        int count1=0;
        while(num0%2==0)
        {
            count1++;
            num0/=2;
        }
        if(count1>0)
        {
            arr0[pos0][2]+=count1;
        }
        for(int i=3;i<Math.sqrt(num0)+1;i++)
        {
            int count2=0;
            while(num0%i==0)
            {
                count2++;
                num0/=i;
            }
            if(count2>0)
            {
                arr0[pos0][i]+=count2;
            }
        }
        if(num0>2)
        {
            arr0[pos0][num0]+=1;
        }
        return arr0;
    }

    static long GCD (long num0,long num00)
    {
        BigInteger big1=BigInteger.valueOf(num0);
        BigInteger big2=BigInteger.valueOf(num00);
        big1=big1.gcd(big2);
        long num000=Long.parseLong(big1.toString());
        return num000;
    }

    static long power1 (long num0,long num00)
    {
        long res1 = 1;
        while (num00 > 0)
        {
            if (num00 % 2 != 0)
            {
                res1 = (res1 * (num0 % 100006)) % 1000016;
            }
            num0 *= num0;
            num0 %= 1000016;
            num00 /= 2;
        }
        return res1;
    }

    static HashSet<Integer> primeDivi(int num0)
    {
        HashSet<Integer> hSet1=new HashSet<>();
        int num00=(int)Math.sqrt(num0);
        hSet1.add(1);
        for(int i=2;i<num00+1;i++)
        {
            if(num0%i==0)
            {
                hSet1.add(i);
                hSet1.add(num0/i);
            }
        }
        return hSet1;
    }

    static int nCrModp(int n, int r, int p)
    {
        int C[]=new int[r+1];
        Arrays.fill(C,0);
        C[0] = 1;

        for (int i = 1; i <= n; i++)
        {

            for (int j = Math.min(i, r); j > 0; j--)
            {
                C[j] = (C[j] + C[j - 1]) % p;
            }
        }
        return C[r];
    }

    static long gcd(long num0,long num00)
    {
        if(num00==0)
        {
            return num0;
        }
        return gcd(num00,num0%num00);
    }


    static boolean heapCheck(int arr[], int i, int n) {
        if (i > (n - 2) / 2) {
            return true;
        }

        if (arr[i] >= arr[2 * i + 1] && arr[i] >= arr[2 * i + 2]
                && heapCheck(arr, 2 * i + 1, n) && heapCheck(arr, 2 * i + 2, n)) {
            return true;
        }
        return false;
    }

    static class Node
    {
        int data;
        Node left,right;
        Node(int data0)
        {
            this.data=data0;
            this.left=null;
            this.right=null;
        }
    }



    public static void main(String[] args) throws IOException {
        Reader r = new Reader();
        //PrintWriter writer=new PrintWriter(System.out);
        //Scanner r = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        OutputWriter77 out77=new OutputWriter77(System.out);

        int num1=r.nextInt();
        int[] arr1=r.nextArray(num1*num1);
        HashMap<Integer,Integer> hashMap=new HashMap<>();
        int num2=num1*num1;
        for(int i=0;i<num2;i++)
        {
            if (hashMap.containsKey(arr1[i]))
            {
                hashMap.put(arr1[i],hashMap.get(arr1[i])+1);
            }
            else
            {
                hashMap.put(arr1[i],1);
            }
        }
        int[][] res1=new int[num1][num1];
        int len1=hashMap.size();
        Integer[] arr2=new Integer[len1];
        arr2=hashMap.keySet().toArray(arr2);
        String ans1="YES";
        int[] arr3=new int[len1];
        me1: for(int i=0;i<len1;i++)
        {
            int num3=hashMap.get(arr2[i]);
            arr3[i]=num3;
        }
        if(num1%2==0)
        {
            me1: for(int i=0;i<len1;i++)
            {
                if(arr3[i]%4!=0)
                {
                    ans1="NO";
                    break me1;
                }
            }

            if(ans1.equals("YES"))
            {
                int pos1 = 0;
                for (int i = 0; i < num1 / 2; i++)
                {
                    for (int j = 0; j < num1 / 2; j++)
                    {
                        res1[i][j] = arr2[pos1];
                        res1[num1-i-1][j]=arr2[pos1];
                        res1[i][num1-j-1]=arr2[pos1];
                        res1[num1-i-1][num1-j-1]=arr2[pos1];
                        arr3[pos1]-=4;
                        if(arr3[pos1]==0)
                        {
                            pos1++;
                        }
                    }
                }
            }
            out77.print(ans1+"\n");
            if(ans1.equals("YES"))
            {
                for(int i=0;i<num1;i++)
                {
                    for(int j=0;j<num1;j++)
                    {
                        out77.print(res1[i][j]+" ");
                    }
                    out77.print("\n");
                }
            }
        }
        else
        {
            int count1=0;
            boolean bool1=true;
            int mid1=0;
            for(int i=0;i<len1;i++)
            {
                if(arr3[i]%2==1)
                {
                    count1++;
                    mid1=arr2[i];
                    arr3[i]--;
                }
            }
            if(count1!=1)
            {
                ans1="NO";
                bool1=false;
            }
            if(bool1)
            {

                int num3=(num1/2)*(num1/2);
                int count2=0;
                for(int i=0;i<len1;i++)
                {
                    count2+=(arr3[i]/4);
                }
                if(count2<num3)
                {
                    bool1=false;
                    ans1="NO";
                }
                int pos3=0,pos5=0;
                int[] arr5=new int[(num1*2)-2];
                /*
                for(int i=0;i<len1;i++)
                {
                    out77.print(arr3[i]+" ");
                }
                out77.print("\n");
                */
                if(bool1)
                {
                    for(int i=0;i<num1/2;i++)
                    {
                        for(int j=0;j<num1/2;j++)
                        {
                            if(arr3[pos3]>=4)
                            {
                                res1[i][j] = arr2[pos3];
                                res1[num1-i-1][j]=arr2[pos3];
                                res1[i][num1-j-1]=arr2[pos3];
                                res1[num1-i-1][num1-j-1]=arr2[pos3];
                                arr3[pos3]-=4;
                            }
                            else
                            {
                                pos3++;
                                j--;
                            }
                        }
                    }
                    /*
                    for(int i=0;i<len1;i++)
                    {
                        out77.print(arr3[i]+" ");
                    }
                    */
                    out77.print("\n");
                    int pos7=0;
                    for(int i=0;i<len1;i++)
                    {
                        int num003=arr3[i]/2;
                        if(num003!=0)
                        {
                            for (int j = 0; j < num003; j++)
                            {
                                if(pos7<((num1*2)-2)) {
                                    arr5[pos7++] = arr2[i];
                                }
                                else
                                {
                                    bool1=false;
                                    ans1="NO";
                                }
                            }
                        }
                    }
                    if(pos7!=(num1/2)*2)
                    {
                        bool1=false;
                        ans1="NO";
                    }
                    pos7=0;
                    if(bool1)
                    {
                        me2: for(int i=0;i<num1/2;i++)
                        {
                            res1[num1/2][i]=arr5[pos7];
                            res1[num1/2][num1-i-1]=arr5[pos7++];
                        }
                        me3: for(int i=0;i<num1/2;i++)
                        {
                            res1[i][num1/2]=arr5[pos7];
                            res1[num1-i-1][num1/2]=arr5[pos7++];

                        }
                    }
                    res1[num1/2][num1/2]=mid1;
                }
            }
            out77.print(ans1+"\n");
            if(bool1)
            {
                for(int i=0;i<num1;i++)
                {
                    for(int j=0;j<num1;j++)
                    {
                        out77.print(res1[i][j]+" ");
                    }
                    out77.print("\n");
                }
            }
        }
        r.close();
        out77.close();


    }
}
class OutputWriter77
{
    BufferedWriter writer;

    public OutputWriter77(OutputStream stream)
    {
        writer = new BufferedWriter(new OutputStreamWriter(stream));
    }

    public void print(int i) throws IOException
    {
        writer.write(i + "");
    }

    public void println(int i) throws IOException
    {
        writer.write(i + "\n");
    }

    public void print(String s) throws IOException
    {
        writer.write(s + "");
    }

    public void println(String s) throws IOException
    {
        writer.write(s + "\n");
    }

    public void print(char[] c) throws IOException
    {
        writer.write(c);
    }

    public void close() throws IOException
    {
        writer.flush();
        writer.close();
    }
}