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.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.LinkedBlockingDeque;


public class scratch_25 {
    // int count=0;
    //static long count=0;
    static class Reader {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /**
         * call this method to initialize reader for InputStream
         */
        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        /**
         * get next word
         */
        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

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

        static long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }





    static class Pair implements Comparable<Pair>{
        long x;
        long y;
        public Pair(long x,long y){
            this.x=x;
            this.y=y;
        }
        @Override
        public int compareTo(Pair o){
            return (int)this.x-(int)o.x;


        }
        @Override
        public boolean equals(Object me) {
            Pair binMe = (Pair)me;
            if(this.x==binMe.x && this.y==binMe.y)
                return true;
            else
                return false;
        }

        @Override
        public int hashCode() {
            return (int)this.x + (int)this.y;
        }

        @Override
        public String toString() {
            return x+" "+y;
        }


    }







    public static void main(String[] args)  throws IOException {
        Reader.init(System.in);
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
        int n= Reader.nextInt();
        HashMap<Integer, Integer>map= new HashMap<>();
        int num=n*n;
        int ans[][]= new int[n][n];
        for (int i = 0; i <num ; i++) {
            int x= Reader.nextInt();
            if(!map.containsKey(x)){
                map.put(x,1);
            }
            else{
                map.put(x,map.get(x)+1);
            }
        }
        ArrayList<Integer>ar= new ArrayList<>(map.keySet());


        if(n%2==0){
            boolean b=true;
            for (int i = 0; i <ar.size() ; i++) {
                if(map.get(ar.get(i))%4!=0){
                    b=false;
                    break;
                }
            }
            if(!b){
            out.append("NO"); 
            }
            if(b){
                out.append("YES"+"\n");
             int p=0;
                for (int i = 0; i <n/2; i++) {
                    for (int j = 0; j <n/2 ; j++) {
                        int x= ar.get(p);
                        if(map.get(x)-4==0){
                            map.put(x,0);
                            p++;
                        }
                        map.put(x,map.get(x)-4);
                        ans[i][j]=x;
                        ans[n-1-i][j]=x;
                        ans[i][n-1-j]=x;
                        ans[n-1-i][n-1-j]=x;
                    }
                }


                for (int i = 0; i <n ; i++) {
                    for (int j = 0; j <n ; j++) {
                        out.append(ans[i][j]+" ");
                    }
                    out.append("\n");
                }
            }
        }

        else if(n%2!=0){
            boolean b=true;
            int p=0;
            for (int i = 0; i <n/2 ; i++) {
                for (int j = 0; j <n/2 ; j++) {
                    if(p>=ar.size()){
                        b=false;
                        break;
                    }
                    if(map.get(ar.get(p))>=4){
                        int v= ar.get(p);
                        ans[i][j]=v;
                        ans[n-1-i][j]=v;
                        ans[i][n-1-j]=v;
                        ans[n-1-i][n-1-j]=v;
                        map.put(v,map.get(v)-4);
                    }
                    else{
                        while(map.get(ar.get(p))<4){
                            p++;
                            if(p>=ar.size()){
                                b=false;
                                break;
                            }
                        }
                        if(b){
                            int v= ar.get(p);
                            ans[i][j]=v;
                            ans[n-1-i][j]=v;
                            ans[i][n-1-j]=v;
                            ans[n-1-i][n-1-j]=v;
                            map.put(v,map.get(v)-4);
                        }
                        else{
                            break;
                        }
                    }
                }
            }

//            for (int i = 0; i <n ; i++) {
//                System.out.println(Arrays.toString(ans[i]));
//            }
             p=0;
            for (int i = 0; i <n/2 ; i++) {
                if(p>=ar.size()){
                    b=false;
                    break;
                }
                if(map.get(ar.get(p))>=2){
                    int v= ar.get(p);
                    ans[n/2][i]=v;
                    ans[n/2][i]=v;
                    ans[n/2][n-i-1]=v;
                    ans[n/2][n-i-1]=v;
                    map.put(v,map.get(v)-2);
                }
                else{
                    while(map.get(ar.get(p))<2){
                        p++;
                        if(p>=ar.size()){
                            b=false;
                            break;
                        }
                    }
                    if(b){
                        int v= ar.get(p);
                        ans[n/2][i]=v;
                        ans[n/2][i]=v;
                        ans[n/2][n-i-1]=v;
                        ans[n/2][n-i-1]=v;
                        map.put(v,map.get(v)-2);
                    }
                    else{
                        break;
                    }

                }
            }


            for (int i = 0; i <n/2 ; i++) {
                if(p>=ar.size()){
                    b=false;
                    break;
                }
                if(map.get(ar.get(p))>=2){
                    int v= ar.get(p);
                    ans[i][n/2]=v;
                    ans[i][n/2]=v;
                    ans[n-i-1][n/2]=v;
                    ans[n-i-1][n/2]=v;
                    map.put(v,map.get(v)-2);
                }
                else{
                    while(map.get(ar.get(p))<2){
                        p++;
                        if(p>=ar.size()){
                            b=false;
                            break;
                        }
                    }
                    if(b){
                        int v= ar.get(p);
                        ans[i][n/2]=v;
                        ans[i][n/2]=v;
                        ans[n-i-1][n/2]=v;
                        ans[n-i-1][n/2]=v;
                        map.put(v,map.get(v)-2);
                    }
                    else{
                        break;
                    }

                }

            }

            p=0;
            while(map.get(ar.get(p))<1){
                p++;
                if(p>=ar.size()){
                    b=false;
                    break;
                }}
                        if(b) {
                            ans[n / 2][n / 2] = ar.get(p);
                        }



          if(!b){
              out.append("NO"+"\n");
          }
          else{
              out.append("YES"+"\n");
              for (int i = 0; i <n ; i++) {
                  for (int j = 0; j <n ; j++) {
                      out.append(ans[i][j]+" ");
                  }
                  out.append("\n");
              }
          }











            
        }










        out.flush();
        out.close();

    }

























    public static ArrayList<Integer> Sieve(int n) {
        boolean arr[]= new boolean [n+1];
        Arrays.fill(arr,true);
        arr[0]=false;
        arr[1]=false;
        for (int i = 2; i*i <=n ; i++) {
            if(arr[i]){
                for (int j = 2; j <=n/i ; j++) {
                    int u= i*j;
                    arr[u]=false;
                }}
        }
        ArrayList<Integer> ans= new ArrayList<>();
        for (int i = 0; i <n+1 ; i++) {
            if(arr[i]){
                ans.add(i);
            }
        }
        return ans;
    }




    static long power( long x, long y, long p)
    {

        long res = 1;


        x = x % p;

        if (x == 0) return 0;

        while (y > 0)
        {

            if((y & 1)==1)
                res = (res * x) % p;


            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }

    public static long ceil_div(long a, long b){
        return (a+b-1)/b;
    }

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

    static long lcm(long a, long b)
    {
        return (a*b)/gcd(a, b);
    }

}