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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CPalindromicMatrix solver = new CPalindromicMatrix();
        solver.solve(1, in, out);
        out.close();
    }

    static class CPalindromicMatrix {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            Debug debug = new Debug();
            int n = in.nextInt();
            int[] a = in.nextIntArray(n * n);
            if (n == 1) {
                out.println("YES");
                out.println(a[0]);
                return;
            }
            int[][] map = new int[n][n];
            ArrayUtils.fill(map, -1);
            a = ArrayUtils.sort(a);

            ArrayList<Integer> nums = new ArrayList<>();
            for (int i = 0; i < a.length; ) {
                int j = i;
                while (j < a.length && a[j] == a[i]) ++j;
                int size = (j - i) / 4;
                for (int p = 0; p < size; ++p) nums.add(a[i]);
                for (int p = i; p < i + (size * 4); ++p) a[p] = -1;
                i = j;
            }

            int ptr = 0;
            try {
                for (int i = 0; i < n / 2; ++i) {
                    for (int j = 0; j < n / 2; ++j) {
                        map[i][j] = map[n - 1 - i][j] = map[i][n - 1 - j] = map[n - 1 - i][n - 1 - j] = nums.get(ptr);
                        ++ptr;
                    }
                }
            } catch (Exception e) {
                out.println("NO");
                return;
            }

            a = ArrayUtils.sort(a);
            ArrayList<Integer> rem = new ArrayList<>();
            for (int i = ptr; i < nums.size(); ++i) {
                rem.add(nums.get(i));
                rem.add(nums.get(i));
            }
            nums = rem;
            try {
                if (n % 2 == 1) {
                    int i = 0;
                    while (i < a.length && a[i] == -1) ++i;
                    for (; i < a.length; ) {
                        int j = i;
                        while (j < a.length && a[j] == a[i]) ++j;
                        int size = (j - i) / 2;
                        for (int p = 0; p < size; ++p) nums.add(a[i]);
                        for (int p = i; p < i + (size * 2); ++p) a[p] = -1;
                        i = j;
                    }
//                debug.tr(a);
//                debug.tr(nums);
                    ptr = 0;
                    for (int j = 0; j < n / 2; ++j) {
                        map[n / 2][j] = map[n / 2][n - 1 - j] = nums.get(ptr);
                        ++ptr;
                    }
//                debug.tr(map);
                    for (int j = 0; j < n / 2; ++j) {
                        map[j][n / 2] = map[n - 1 - j][n / 2] = nums.get(ptr);
                        ++ptr;
                    }
//                debug.tr(map);
                    a = ArrayUtils.sort(a);
                    rem = new ArrayList<>();
                    for (i = ptr; i < nums.size(); ++i) {
                        rem.add(nums.get(i));
                        rem.add(nums.get(i));
                    }
                    nums = rem;
                    i = 0;
                    while (i < a.length && a[i] == -1) ++i;
                    if (i < a.length) nums.add(a[a.length - 1]);
//                debug.tr(nums);
                    if (nums.size() > 1) {
                        out.println("NO");
                        return;
                    }
                    if (n % 2 == 1) map[n / 2][n / 2] = nums.get(0);
                }
            } catch (Exception e) {
                out.println("NO");
                return;
            }
            if (check(map)) {
                out.println("YES");
                ArrayUtils.printMap(out, map);
                return;
            }
        }

        private boolean check(int[][] map) {
            int n = map.length;
            final int bad = -1;

            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < n; ++j) {
                    if (map[i][j] == bad) return false;
                }
            }

            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < n; ++j) {
                    if (map[i][j] != map[n - 1 - i][j]) return false;
                    if (map[i][j] != map[i][n - 1 - j]) return false;
                    if (map[i][j] != map[n - 1 - i][n - j - 1]) return false;
                }
            }
            return true;
        }

    }

    static class ArrayUtils {
        public static int[] sort(int[] a) {
            a = shuffle(a, new SplittableRandom());
            Arrays.sort(a);
            return a;
        }

        public static int[] shuffle(int[] a, SplittableRandom gen) {
            for (int i = 0, n = a.length; i < n; i++) {
                int ind = gen.nextInt(n - i) + i;
                int d = a[i];
                a[i] = a[ind];
                a[ind] = d;
            }
            return a;
        }

        public static void fill(int[][] array, int value) {
            for (int[] row : array) {
                Arrays.fill(row, value);
            }
        }

        public static void printArray(PrintWriter out, int[] array) {
            if (array.length == 0) return;
            for (int i = 0; i < array.length; i++) {
                if (i != 0) out.print(" ");
                out.print(array[i]);
            }
            out.println();
        }

        public static void printMap(PrintWriter out, int[][] map) {
            for (int i = 0; i < map.length; i++) {
                printArray(out, map[i]);
            }
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

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

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

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

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

    }

    static class Debug {
        PrintWriter out;
        boolean oj;
        long timeBegin;
        Runtime runtime;

        public Debug(PrintWriter out) {
            oj = System.getProperty("ONLINE_JUDGE") != null;
            this.out = out;
            this.timeBegin = System.currentTimeMillis();
            this.runtime = Runtime.getRuntime();
        }

        public Debug() {
            oj = System.getProperty("ONLINE_JUDGE") != null;
            OutputStream outputStream = System.err;
            this.out = new PrintWriter(outputStream);
            this.timeBegin = System.currentTimeMillis();
            this.runtime = Runtime.getRuntime();
        }

        public void finalize() {
            out.flush();
            out.close();
        }

    }
}

