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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class C {

    private static int pos, len;
    private static int max, min;
    private static int cur, sum;
    private static int ans, res;
    private static int ai, bi, ci, di;
    private static int[] aix, bix;
    private static int[][] aixx, bixx;
    private static long al, bl, cl, dl;
    private static long[] alx, blx;
    private static long[][] alxx, blxx;
    private static double ad, bd, cd, dd;
    private static double[] adx, bdx;
    private static double[][] adxx, bdxx;
    private static boolean ab, bb, cb, db;
    private static boolean[] abx, bbx;
    private static boolean[][] abxx, bbxx;
    private static char ac, bc, cc, dc;
    private static char[] acx, bcx;
    private static char[][] acxx, bcxx;
    private static String as, bs, cs, ds;
    private static String[] asx, bsx;
    private static InputReader in = new InputReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int m = 1001;
        int[] num = new int[m];
        int k = n * n;
        while (k-- > 0) {
            num[in.nextInt()]++;
        }

        int[][] martix = new int[n][n];
        boolean ok = true;
        // center
        if (n % 2 == 1) {
            boolean find = false;
            for (int i = 1; i < m; i++) {
                if (num[i] % 2 == 1) {
                    martix[n / 2][n / 2] = i;
                    find = true;
                    num[i]--;
                    break;
                }
            }
            if (!find) {
                ok = false;
            }
            for (int i = 1; i < m; i++) {
                if (num[i] % 2 == 1) {
                    ok = false;
                    break;
                }
            }
            int cnt2 = 0;
            for (int i = 1; i < m; i++) {
                if (num[i] % 4 == 2) {
                    cnt2++;
                }
            }
            if (cnt2 >= n || cnt2 % 2 != 0) {
                ok = false;
            }
        }

        if (n % 2 == 1 && ok) {
            int x = n / 2;
            int y = n / 2;
            int tx = 0;
            int ty = 0;
            int t = 0;
            for (int i = 1; i < m; i++) {
                if (num[i] % 4 == 2) {
                    num[i] -= 2;
                    if (t % 2 == 0) {
                        martix[x][ty] = i;
                        martix[x][n - ty - 1] = i;
                        ty++;
                    } else {
                        martix[tx][y] = i;
                        martix[n - tx - 1][y] = i;
                        tx++;
                    }
                    t++;
                }
            }
            if (tx < x || ty < y) {
                for (int i = 1; i < m; i++) {
                    while (num[i] > 0 && num[i] % 2 == 0 && t < n - 1) {
                        num[i] -= 2;
                        if (t % 2 == 0) {
                            martix[x][ty] = i;
                            martix[x][n - ty - 1] = i;
                            ty++;
                        } else {
                            martix[tx][y] = i;
                            martix[n - tx - 1][y] = i;
                            tx++;
                        }
                        t++;
                    }
                }
            }
            x = 0;
            y = 0;
            for (int i = 1; i < m; i++) {
                int cnt = num[i] / 4;
                while (cnt-- > 0) {
                    martix[x][y] = i;
                    martix[x][n - y - 1] = i;
                    martix[n - x - 1][y] = i;
                    martix[n - x - 1][n - y - 1] = i;
                    y = (y + 1) % (n / 2);
                    x += (y == 0 ? 1 : 0);
                }
            }
        }

        if (n % 2 == 0) {
            for (int i = 1; i < m; i++) {
                if (num[i] % 4 != 0) {
                    ok = false;
                    break;
                }
            }
        }
        if (n % 2 == 0 && ok) {
            int x = 0;
            int y = 0;
            for (int i = 1; i < m; i++) {
                int cnt = num[i] / 4;
                while (cnt-- > 0) {
                    martix[x][y] = i;
                    martix[x][n - y - 1] = i;
                    martix[n - x - 1][y] = i;
                    martix[n - x - 1][n - y - 1] = i;
                    y = (y + 1) % (n / 2);
                    x += (y == 0 ? 1 : 0);
                }
            }
        }
        if (!ok) {
            out.println("NO");
        } else {
            out.println("YES");
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    out.printf("%d ", martix[i][j]);
                }
                out.println();
            }
        }
        out.close();
    }

    private static class InputReader {

        private InputStream stream;

        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private 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();
        }

        private 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++];
        }
    }
}