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 static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.*;
import static java.lang.System.exit;

import java.io.*;
import java.util.*;

public class A {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws Exception {
        int n = nextInt();
        int[][] ans = new int[n][n];
        int a[] = radixSort(na(n * n));
//        for (int x:a) out.print(x + " ");out.println();
        Map<Integer, Integer> count = new HashMap<>();
        for(int x:a) {
            if(!count.containsKey(x)) count.put(x, 0);
            count.put(x, count.get(x) + 1);
        }
        if(n % 2 == 0) {
            for(int x:count.keySet()) if(count.get(x) % 4 != 0) { out.println("NO"); return; }
            for(int i = 0; i < n; i++)
                for(int j = 0; j < n; j++)
                    if(ans[i][j] == 0)
                        for(int x:count.keySet()) if(count.get(x) > 0) {
                            count.put(x, count.get(x) - 4);
                            ans[i][j] = ans[i][n - j - 1] = ans[n - i - 1][j] = ans[n - i - 1][n - j - 1] = x;
                            break;
                        }
        } else {
            for(int x:count.keySet()) if(count.get(x) % 2 != 0) {
                ans[n / 2][n / 2] = x;
                count.put(x, count.get(x) - 1);
                break;
            }
            for(int i = 0; i < n; i++)
                for(int j = 0; j < n; j++)
                    if(ans[i][j] == 0 && i != n / 2 && j != n / 2)
                        for(int x:count.keySet()) if(count.get(x) >= 4) {
                            count.put(x, count.get(x) - 4);
                            ans[i][j] = ans[i][n - j - 1] = ans[n - i - 1][j] = ans[n - i - 1][n - j - 1] = x;
                            break;
                        }
            for(int j = 0; j <= n / 2 - 1; j++) {
                for(int x:count.keySet()) if(count.get(x) == 2) {
                    ans[n / 2][j] = ans[n / 2][n - j - 1] = x;
                    count.put(x, count.get(x) - 2);
                    break;
                }
            }
            for(int i = 0; i <= n / 2 - 1; i++) {
                for(int x:count.keySet()) if(count.get(x) == 2) {
                    ans[i][n / 2] = ans[n - i - 1][n / 2] = x;
                    count.put(x, count.get(x) - 2);
                    break;
                }
            }
            for(int j = 0; j <= n / 2 - 1; j++)
                if(ans[n / 2][j] == 0) {
                for(int x:count.keySet()) if(count.get(x) >= 2) {
                    ans[n / 2][j] = ans[n / 2][n - j - 1] = x;
                    count.put(x, count.get(x) - 2);
                    break;
                }
            }
            for(int i = 0; i <= n / 2 - 1; i++)
                if(ans[i][n / 2] == 0) {
                for(int x:count.keySet()) if(count.get(x) >= 2) {
                    ans[i][n / 2] = ans[n - i - 1][n / 2] = x;
                    count.put(x, count.get(x) - 2);
                    break;
                }
            }
            for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(ans[i][j] == 0) { out.println("NO"); return; }
        }
        out.println("YES");
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) out.print(ans[i][j] + " ");
            out.println();
        }
    }


    // call it like this: lower_bound(a, x + 1) ( /!\ + 1 )
    public static int lower_bound(int[] a, int v) {
        int low = -1, high = a.length;
        while (high - low > 1) {
            int h = high + low >>> 1;
            if (a[h] >= v) {
                high = h;
            } else {
                low = h;
            }
        }
        return high;
    }

    private int gcd(int a, int b) {
        while (b > 0) {
            int temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private int lcm(int a, int b) {
        return a * (b / gcd(a, b));
    }

    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }

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

    private long[] nal(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }

    int nextInt() throws IOException {
        return parseInt(next());
    }

    long nextLong() throws IOException {
        return parseLong(next());
    }

    double nextDouble() throws IOException {
        return parseDouble(next());
    }

    String next() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    public static void main(String[] args) throws Exception {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            //long lStartTime = System.currentTimeMillis();
            new A().solve();
            //long lEndTime = System.currentTimeMillis();
            //out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}