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

/* abhi2601 */

public class Q1 implements Runnable{

    final static long mod = (long)1e9 + 7;

    class pair{
        int p,q;
        pair(int p,int q){
            this.p=p;
            this.q=q;
        }
    }

    int gcd(int a, int b){
       if(b==0) return a;
       return gcd(b,a%b);
    }

    public void run() {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n=sc.nextInt();
        HashMap<Integer,Integer>hm=new HashMap<>();
        int a[][]=new int[n][n];
        for(int i=0;i<(n*n);i++){
            int q=sc.nextInt();
            if(hm.containsKey(q)) hm.put(q,hm.get(q)+1);
            else hm.put(q,1);
        }
        if(n==1){
            w.println("YES");
            for(Integer i: hm.keySet()) w.println(i);
            w.close();
        }
        else if(n%2==0){
            int c=0;
            for(Integer i: hm.keySet()){
                if(hm.get(i)%4!=0){
                    w.println("NO");
                    c++;
                    w.close();
                    break;
                }
            }
            if(c==0){
                for(int i=0;i<n/2;i++){
                    for(int j=0;j<n/2;j++){
                        for(Integer k: hm.keySet()){
                            if(hm.get(k)!=0){
                                a[i][j]=k;
                                a[i][n-j-1]=k;
                                a[n-i-1][j]=k;
                                a[n-i-1][n-j-1]=k;
                                hm.put(k,hm.get(k)-4);
                                break;
                            }
                        }
                    }
                }
                w.println("YES");
                for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        w.print(a[i][j]+" ");
                    }
                    w.println();
                }
            }
        }
        else{
            int c=(n/2)*(n/2),t=0;
            for(Integer i: hm.keySet()){
                t+=(hm.get(i)/4);
            }
            if(t<c){
                w.println("NO");
                w.close();
            }
            else{
                for(int i=0;i<n/2;i++){
                    for(int j=0;j<n/2;j++){
                        for(Integer k: hm.keySet()){
                            if(hm.get(k)>=4){
                                a[i][j]=k;
                                a[i][n-j-1]=k;
                                a[n-i-1][j]=k;
                                a[n-i-1][n-j-1]=k;
                                hm.put(k,hm.get(k)-4);
                                break;
                            }
                        }
                    }
                }
                int m=n/2;
                for(int i=0;i<n/2;i++){
                    for(Integer k: hm.keySet()){
                        if(hm.get(k)>1){
                            a[m][i]=k;
                            a[m][n-i-1]=k;
                            hm.put(k,hm.get(k)-2);
                            break;
                        }
                    }
                }
                for(int i=0;i<n/2;i++){
                    for(Integer k: hm.keySet()){
                        if(hm.get(k)>1){
                            a[i][m]=k;
                            a[n-i-1][m]=k;
                            hm.put(k,hm.get(k)-2);
                            break;
                        }
                    }
                }
                for(Integer k: hm.keySet()){
                    if(hm.get(k)>0){
                        a[m][m]=k;
                        hm.put(k,hm.get(k)-1);
                        break;
                    }
                }
                int z=0;
                for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        if(a[i][j]==0){
                            z++;
                            break;
                        }
                    }
                    if(z!=0) break;
                }
                if(z==0){
                    w.println("YES");
                    for(int i=0;i<n;i++){
                        for(int j=0;j<n;j++){
                            w.print(a[i][j]+" ");
                        }
                        w.println();
                    }
                }
                else w.println("NO");
            }
        }
        w.close();
    }
    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        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()
        {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            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 Q1(),"q1",1<<26).start();
    }
}