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:
//package year2019.month01.cf.round540div3;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class round540div3C {

    boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null);

    public round540div3C() throws IOException {
        InputReader in;
        if (ONLINE_JUDGE) {
            in = new InputReader(System.in);
        } else {
            in = new InputReader(new FileInputStream("/Users/karj/cp/input.txt"));
        }
        PrintWriter out = new PrintWriter(System.out);

        int T = 1;
        for (int caseNo = 1; caseNo <= T; caseNo++) {
            solve(caseNo, in, out);
        }

        out.close();
    }

    private void solve(int caseNo, InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        long a[] = in.nextLongArray(n * n);
        debug(a);
        if (n == 1) {
            out.println("YES");
            out.println(a[0]);
            return;
        }
        HashMap<Long, Integer> countMap = new HashMap<>();
        for (int i = 0; i < n * n; i++) {
            countMap.put(a[i], countMap.getOrDefault(a[i], 0) + 1);
        }
        int oc = 0; long ov = -1;
        LinkedList<Long> count4 = new LinkedList<>();
        LinkedList<Long> count2 = new LinkedList<>();
        for (Map.Entry<Long, Integer> entry: countMap.entrySet()) {
            if (entry.getValue() % 2 == 1) {
                oc++;
                ov = entry.getKey();
                if (oc > 1) {
                    out.println("NO");
                    return;
                }
                long k = entry.getKey();
                long c = entry.getValue();
                if ((c - 1) % 4 == 0) {
                    for (int i = 0; i < c - 1; i++) {
                        count4.addLast(k);
                    }
                } else if ((c - 1) % 2 == 0) {
                    for (int i = 0; i < c - 3; i++) {
                        count4.addLast(k);
                    }
                    count2.addLast(k);
                    count2.addLast(k);
                }
            } else if (entry.getValue() % 4 == 0) {
                long k = entry.getKey();
                long c = entry.getValue();
                for (int i = 0; i < c; i++) {
                    count4.addLast(k);
                }
            } else if (entry.getValue() % 2 == 0) {
                long k = entry.getKey();
                long c = entry.getValue();
                for (int i = 0; i < c - 2; i++) {
                    count4.addLast(k);
                }
                count2.addLast(k);
                count2.addLast(k);
            }
        }
//        Pair ap[] = new Pair[n * n];
//        for (int i = 0; i < n * n; i++) {
//            ap[i] = new Pair(a[i], countMap.get(a[i]));
//        }
//        Arrays.sort(ap, new Comparator<Pair>() {
//            @Override
//            public int compare(Pair o1, Pair o2) {
//                if (o1.c != o2.c) {
//                    return o2.c - o1.c;
//                } else {
//                    return (int) (o1.v - o2.v);
//                }
//            }
//        });
        LinkedList<Long> l = new LinkedList<>();
//        for (Pair p : ap) {
//            l.addLast(p.v);
//        }
        for (long v : count4) {
            l.addLast(v);
        }
        for (long v : count2) {
            l.addLast(v);
        }
//        if (ov != -1) {
//            l.addLast(ov);
//        }
        debug(l);
        long r[][] = new long[n][n];
        for (int i = 0; i < n / 2; i++) {
            for (int j = 0; j < n / 2; j++) {
                int i1 = i, j1 = j,
                    i2 = n - i - 1, j2 = j,
                    i3 = i, j3 = n - j - 1,
                    i4 = n - i - 1, j4 = n - j - 1;
                r[i1][j1] = l.pollFirst();
                r[i2][j2] = l.pollFirst();
                r[i3][j3] = l.pollFirst();
                r[i4][j4] = l.pollFirst();
                if (r[i1][j1] != r[i2][j2] ||
                        r[i2][j2] != r[i3][j3] ||
                        r[i3][j3] != r[i4][j4] ||
                        r[i4][j4] != r[i1][j1]) {
                    for (long row[] : r) debug(row);
                    out.println("NO");
                    return;
                }
            }
        }
        if (n % 2 == 1) {
            for (int i = 0; i < n / 2; i++) {
                int i1 = i,
                    i2 = n - i - 1;
                int j = n / 2;
                r[i1][j] = l.pollFirst();
                r[i2][j] = l.pollFirst();
                if (r[i1][j] != r[i2][j]) {
                    for (long row[] : r) debug(row);
                    debug(i1, j);
                    debug(i2, j);
                    out.println("NO");
                    return;
                }
            }
            for (int j = 0; j < n / 2; j++) {
                int j1 = j,
                    j2 = n - j - 1;
                int i = n / 2;
                r[i][j1] = l.pollFirst();
                r[i][j2] = l.pollFirst();
                if (r[i][j1] != r[i][j2]) {
                    out.println("NO");
                    return;
                }
            }
            if (ov != -1) {
                r[n / 2][n / 2] = ov;
            } else {
                out.println("NO");
                return;
            }
        }
        if (!l.isEmpty()) {
            out.println("NO");
            return;
        }
        out.println("YES");
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                out.print(r[i][j] + " ");
            }
            out.println();
        }
    }

    class Pair {
        long v;
        int c;

        Pair(long v, int c) {
            this.v = v;
            this.c = c;
        }
    }

    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 static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        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 boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {

            public boolean isSpaceChar(int ch);
        }

        public String next() {
            return nextString();
        }

        public String nextString() {
            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 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() {
            return Long.parseLong(nextString());
        }

        public Double nextDouble() {
            return Double.parseDouble(nextString());
        }

        public char nextCharacter() {
            return nextString().charAt(0);
        }

        public int[] nextIntArray(int N) {
            int A[] = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = nextInt();
            }
            return A;
        }

        public long[] nextLongArray(int N) {
            long A[] = new long[N];
            for (int i = 0; i < N; i++) {
                A[i] = nextLong();
            }
            return A;
        }

        public double[] nextDoubleArray(int N) {
            double A[] = new double[N];
            for (int i = 0; i < N; i++) {
                A[i] = nextDouble();
            }
            return A;
        }
    }

    private void debug(Object... o) {
        if (ONLINE_JUDGE) {
            return;
        }
        System.out.println(Arrays.deepToString(o));
    }

    public static void main(String args[]) throws IOException {
        new round540div3C();
    }
}