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 Test77{

    PrintWriter pw = new PrintWriter(System.out); InputStream is = System.in;
    Random rnd = new Random();
    int a;

    void run(){
        a = ni();
        int k = a*a;
        TreeMap<Integer, Integer> h = new TreeMap<>();
        for(int q=0; q<k; q++){
            int c = ni();
            h.put(c, h.getOrDefault(c,0)+1);
        }
        int[][] o = new int[a][a];
        boolean ans = true;
        if(a%2==0){
            int no = 0;
            for(int u : h.values()) if(u%4!=0) no++;
            if(no>0) ans = false;
            else{
                for(int q=0; q<a; q++){
                    for(int w=0; w<a; w++){
                        if(o[q][w]>0) continue;
                        int c = h.firstKey();
                        o[q][w] = o[a-q-1][w] = o[q][a-w-1] = o[a-q-1][a-w-1] = c;
                        h.put(c, h.get(c)-4);
                        if(h.get(c)==0) h.remove(c);
                    }
                }
            }
        }
        else{
            int odd = 0, num= -1;
            for(int u : h.keySet()){
                if(h.get(u)%2==1) num = u;
                odd+=h.get(u)%2;
            }
            if(odd!=1) ans = false;
            else{
                o[a/2][a/2] = num;
                h.put(num, h.get(num)-1);
                if(h.get(num)==0) h.remove(num);
                TreeMap<Integer, Integer> dv = new TreeMap<>();
                for(int u : h.keySet()) if(h.get(u)%4==2) dv.put(u, h.get(u));
                for(int u : dv.keySet()) h.remove(u);
                if(dv.size()>=a || dv.size()%2==1) ans = false;
                else{
                    for(int q=0; q<a; q++){
                        if(o[q][a/2]>0) continue;
                        if(dv.size()==0) dv.put(h.firstKey(), h.firstEntry().getValue());
                        int c = dv.firstKey();
                        o[q][a/2] = o[a-q-1][a/2] = o[q][a-a/2-1] = o[a-q-1][a-a/2-1] = c;
                        if(dv.get(c)%4==0) dv.put(c, dv.get(c)-2);
                        else {
                            h.put(c, dv.get(c) - 2);
                            if (h.get(c) == 0) h.remove(c);
                            dv.remove(c);
                        }
                    }
                    for(int w=0; w<a; w++){
                        if(o[a/2][w]>0) continue;
                        if(dv.size()==0) dv.put(h.firstKey(), h.firstEntry().getValue());
                        int c = dv.firstKey();
                        o[a/2][w] = o[a-a/2-1][w] = o[a/2][a-w-1] = o[a-a/2-1][a-w-1] = c;
                        if(dv.get(c)%4==0) dv.put(c, dv.get(c)-2);
                        else {
                            h.put(c, dv.get(c) - 2);
                            if (h.get(c) == 0) h.remove(c);
                            dv.remove(c);
                        }
                    }
                    for(int q=0; q<a; q++){
                        for(int w=0; w<a; w++){
                            if(o[q][w]>0) continue;
                            int c = h.firstKey();
                            o[q][w] = o[a-q-1][w] = o[q][a-w-1] = o[a-q-1][a-w-1] = c;
                            h.put(c, h.get(c)-4);
                            if(h.get(c)==0) h.remove(c);
                        }
                    }
                }
            }
        }
        if(!ans) pw.print("NO");
        else{
            pw.println("YES");
            for(int[] p : o){
                for(int u : p) pw.print(u+" ");
                pw.println();
            }
        }
        pw.flush();
    }

    static class PyraSort {

        private static int heapSize;

        public static void sort(int[] a) {
            buildHeap(a);
            while (heapSize > 1) {
                swap(a, 0, heapSize - 1);
                heapSize--;
                heapify(a, 0);
            }
        }

        private static void buildHeap(int[] a) {
            heapSize = a.length;
            for (int i = a.length / 2; i >= 0; i--) {
                heapify(a, i);
            }
        }

        private static void heapify(int[] a, int i) {
            int l = 2 * i + 2;
            int r = 2 * i + 1;
            int largest = i;
            if (l < heapSize && a[i] < a[l]) {
                largest = l;
            }
            if (r < heapSize && a[largest] < a[r]) {
                largest = r;
            }
            if (i != largest) {
                swap(a, i, largest);
                heapify(a, largest);
            }
        }

        private static void swap(int[] a, int i, int j) {
            a[i] ^= a[j] ^= a[i];
            a[j] ^= a[i];
        }
    }

    public static void main(String[] args) {
        new Test77().run();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
}