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.math.BigInteger;
import java.security.SecureRandom;
import java.text.DecimalFormat;
import java.util.*;
import java.io.*;
import java.util.concurrent.CompletableFuture;


public class Main {







    private static long cube(long x) {
        return x*x*x;
    }

    public static void main(String[] args) throws Exception {
        IO io ;
        try {
            io = new IO("in.in", null);
        } catch (IOException e) {
            io = new IO(null, null);
        }

        int n = io.getNextInt();
        int [] freq = new int[1024];
        for (int i = 0;i < n*n;i++)
            freq[io.getNextInt()]++;

        Queue<Integer> grq4 = new LinkedList<>();
        Queue<Integer> other = new LinkedList<>();
        Queue<Integer> gr2 = new LinkedList<>();

        for (int i = 0;i < freq.length;i++){
            if (freq[i] == 0) continue;
            if (freq[i] >= 4) grq4.add(i);
            else if (freq[i] >= 2) gr2.add(i);
            else if (freq[i] == 1) other.add(i);
        }

        boolean y = true;

        int [] [] A = new int[n][n];
        for (int i = 0;i < n/2 && y;i++)
            for (int j = 0;j < n/2 && y;j++) {
                if (grq4.isEmpty()) {
                    y = false;
                    break;
                }
                int x = grq4.poll();
                freq[x] -= 4;

                if (freq[x] >= 4) grq4.add(x);
                else if (freq[x] >= 2) gr2.add(x);
                else if (freq[x] == 1) other.add(x);

                A[i][j] = x;
                A[n-1-i][j] = x;
                A[i][n-1-j] = x;
                A[n-1-i][n-1-j] = x;
            }

        while (!grq4.isEmpty()) gr2.add(grq4.poll());

        if (n%2 == 1 && y) {
            int pivot = n/2;
            for (int i = 0;i < n/2 && y;i++) {
                if (gr2.isEmpty()) {
                    y = false;
                    break;
                }
                int x = gr2.poll();
                freq[x] -= 2;

                if (freq[x] >= 2) gr2.add(x);
                else if (freq[x] == 1) other.add(x);

                A[pivot][i] = A[pivot][n-1-i] = x;
            }
            for (int i = 0;i < n/2 && y;i++) {
                if (gr2.isEmpty()) {
                    y = false;
                    break;
                }
                int x = gr2.poll();
                freq[x] -= 2;

                if (freq[x] >= 2) gr2.add(x);
                else if (freq[x] == 1) other.add(x);

                A[i][pivot] = A[n-1-i][pivot] = x;
            }

            while (!gr2.isEmpty()) other.add(gr2.poll());
            if (other.isEmpty()) y = false;
            else {
                A[n/2][n/2] = other.poll();
            }
        }
        if (y) {
            io.println("YES");
            for (int i = 0;i < n;i++) {
                io.print(A[i][0]);
                for (int j = 1;j < n;j++)
                    io.print(" " + A[i][j]);
                io.println("");
            }
        }
        else io.println("NO");
        io.close();
    }
    private static final int onebillion7 = 1000000007;
}





class pair{
    int val,type;
    public pair(int v,int t) {
        val = v;
        type = t;
    }
    @Override
    public String toString(){
        return "(" + val + ", " + type + ")";
    }
}

class Buffer{
    ArrayList<Character> AS;
    public Buffer(){
        AS = new ArrayList<>();
    }
    public void append(String s){
        for (char c : s.toCharArray())
            AS.add(c);
    }
    public void appendLine(String s) {
        append(s);
        AS.add('\n');
    }
    public void clear(){
        AS.clear();
    }
    public String toString(){
        StringBuilder sb = new StringBuilder();
        for (char c : AS)
            sb.append(c);
        return sb.toString();
    }
}

class IO{
    private BufferedReader br;
    private StringTokenizer st;
    private PrintWriter writer;
    private String inputFile,outputFile;

    public boolean hasMore() throws IOException{
        if(st != null && st.hasMoreTokens()) return true;
        if(br != null && br.ready()) return true;
        return false;
    }

    public String getNext() throws FileNotFoundException, IOException{
        while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public String getNextLine() throws FileNotFoundException, IOException{
        return br.readLine().trim();
    }

    public int getNextInt() throws FileNotFoundException, IOException{
        return Integer.parseInt(getNext());
    }
    public long getNextLong() throws FileNotFoundException, IOException{
        return Long.parseLong(getNext());
    }

    public void print(double x,int num_digits) throws  IOException{
        writer.printf("%." + num_digits + "f" ,x);
    }
    public void println(double x,int num_digits) throws  IOException{
        writer.printf("%." + num_digits + "f\n" ,x);
    }
    public void print(Object o) throws  IOException{
        writer.print(o.toString());
    }

    public void println(Object o) throws  IOException{
        writer.println(o.toString());
    }
    public IO(String x,String y) throws FileNotFoundException, IOException{
        inputFile = x;
        outputFile = y;
        if(x != null) br = new BufferedReader(new FileReader(inputFile));
        else br = new BufferedReader(new InputStreamReader(System.in));
        if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
        else writer = new PrintWriter(new OutputStreamWriter(System.out));
    }

    protected void close() throws IOException{
        br.close();
        writer.close();
    }
    public void outputArr(Object [] A) throws IOException{
        int L = A.length;
        for (int i = 0;i < L;i++) {
            if(i > 0) writer.print(" ");
            writer.print(A[i]);
        }
        writer.print("\n");
    }
}



//class PollardRho {
//    private final static BigInteger ZERO = new BigInteger("0");
//    private final static BigInteger ONE  = new BigInteger("1");
//    private final static BigInteger TWO  = new BigInteger("2");
//    private final static SecureRandom random = new SecureRandom();
//    private static ArrayList<Long> primes = new ArrayList<>();
//
//    private static BigInteger rho(BigInteger N) {
//        BigInteger divisor;
//        BigInteger c  = new BigInteger(N.bitLength(), random);
//        BigInteger x  = new BigInteger(N.bitLength(), random);
//        BigInteger xx = x;
//
//        // check divisibility by 2
//        if (N.base(TWO).compareTo(ZERO) == 0) return TWO;
//
//        do {
//            x  =  x.multiply(x).base(N).add(c).base(N);
//            xx = xx.multiply(xx).base(N).add(c).base(N);
//            xx = xx.multiply(xx).base(N).add(c).base(N);
//            divisor = x.subtract(xx).gcd(N);
//        } while((divisor.compareTo(ONE)) == 0);
//
//        return divisor;
//    }
//
//    private static void factor(BigInteger N) {
//        if (N.compareTo(ONE) == 0) return;
//        if (N.isProbablePrime(20)) {
//            primes.add(N.longValue());
//            return;
//        }
//        BigInteger divisor = rho(N);
//        factor(divisor);
//        factor(N.divide(divisor));
//    }
//
//
//    public static ArrayList<Long> factor(Long n) {
//        primes.clear();
//        factor(BigInteger.valueOf(n));
//        return primes;
//    }
//}