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.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

    public static void main(String[] args) throws IOException {
        BufferedWriter bw = new BufferedWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        InputReader ir = new InputReader(System.in);
        int n = ir.nextInt();
        int[] c = new int[1001];
        int[][] ans = new int[n][n];
        for (int i=0; i<n*n; ++i){
            c[ir.nextInt()]++;
        }
        if (n%2==0){
            int c4s = 0;
            for (int i=1; i<c.length; ++i){
                if (c[i] > 0 &&c[i]%4==0)
                    c4s+=c[i]/4;
            }
            if (c4s*4 != n*n){
                System.out.println("NO");
                return;
            }
            System.out.println("YES");
            int ansi = 0;
            int ansj = 0;
            for (int i=1; i<c.length; ++i){
                while (c[i]>0){
                    ans[ansi][ansj] = i;
                    ans[n-ansi-1][ansj] = i;
                    ans[ansi][n-ansj-1] = i;
                    ans[n-ansi-1][n-ansj-1] = i;
                    ansi++;
                    c[i]-=4;
                    if (ansi == n/2){
                        ansi = 0;
                        ansj++;
                    }
                }
            }
        } else {
            int c4s = 0;
            int c2s = 0;
            int c1s = 0;
            for (int i=0; i<c.length; ++i){
                if (c[i] == 0)
                    continue;
                if (c[i]%4 == 0){
                    c4s+=c[i]/4;
                } else if (c[i]%2 == 0){
                    c4s+=c[i]/4;
                    c2s+=1;
                } else {
                    c4s+=c[i]/4;
                    if (c[i]%4==3)
                        c2s+=1;
                    c1s+=1;
                }
            }
            if (c1s > 1){
                System.out.println("NO");
                return;
            }
            if (c2s > n-1){
                System.out.println("NO");
                return;
            }
            System.out.println("YES");
            for (int i=0; i<c.length; ++i){
                if (c[i]%2==1){
                    ans[n/2][n/2] = i;
                    c[i]--;
                    break;
                }
            }

            int ansi = 0;
            for (int i=1; i<c.length; ++i){
                if (c[i]%4 == 2){
                    ans[n/2][ansi] = i;
                    ans[n/2][n-ansi-1] = i;
                    ansi++;
                    c[i]-=2;
                    if (ansi == n/2){
                        break;
                    }
                }
            }
            if (ansi != n/2){
                for (int i=1; i<c.length; ++i){
                    while(c[i]>0) {
                        ans[n / 2][ansi] = i;
                        ans[n / 2][n - ansi - 1] = i;
                        ansi++;
                        c[i] -= 2;
                        if (ansi == n / 2)
                            break;
                    }
                    if (ansi == n/2)
                        break;
                }
            }
            ansi = 0;
            for (int i=1; i<c.length; ++i){
                if (c[i]%4 == 2){
                    ans[ansi][n/2] = i;
                    ans[n-ansi-1][n/2] = i;
                    c[i]-=2;
                    ansi++;
                    if (ansi == n/2)
                        break;
                }
            }
            if (ansi!= n/2){
                for (int i=1; i<c.length; ++i){
                    while (c[i]>0){
                        ans[ansi][n/2] = i;
                        ans[n-ansi-1][n/2] = i;
                        c[i]-=2;
                        ansi++;
                        if (ansi == n/2)
                            break;
                    }
                    if (ansi == n/2)
                        break;
                }
            }
            ansi = 0;
            int ansj = 0;
            for (int i=1; i<c.length; ++i){
                while (c[i]>0){
                    ans[ansi][ansj] = i;
                    ans[n-ansi-1][ansj] = i;
                    ans[ansi][n-ansj-1] = i;
                    ans[n-ansi-1][n-ansj-1] = i;
                    c[i]-=4;
                    ansi++;
                    if (ansi == n/2){
                        ansi = 0;
                        ansj++;
                    }
                }
            }
        }
        for (int i=0; i<n; ++i){
            for (int j=0; j<n; ++j){
                System.out.print(ans[i][j]+" ");
            }
            System.out.println();
        }
        bw.close();
    }

    public static class Node implements Comparable<Node>{
        int r;
        int b;
        int ind;
        boolean visited;
        int nbsc;
        ArrayList<Node> nbs;
        public Node(int r, int b, int ind){
            this.r = r;
            this.b = b;
            this.ind = ind;
            nbs = new ArrayList<>();
            visited = false;
            this.nbsc = 0;
        }

        @Override
        public int compareTo(Node o) {
            return this.nbsc - o.nbsc;
        }
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

    }
}