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.util.Arrays;
import java.util.Scanner;

public class Matrices {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int squareN = n*n;
        int [] a = new int[squareN];
        for(int i = 0 ; i < squareN ; i++)
        {
            a[i] = scanner.nextInt();
        }
        Arrays.sort(a);

        int[][] matrix = new int[n][n];

        if(n%2 == 0)
        {
            int k = 0;
            for(int i = 0; i < n/2; i++)
            {
                for(int j = 0; j < n/2; j++) {
                    int a1 = a[k];
                    int a2 = a[k + 1];
                    int a3 = a[k + 2];
                    int a4 = a[k + 3];
                    if (a1 != a2 || a2 != a3 || a3 != a4) {
                        System.out.println("NO");
                        return;
                    } else {
                        matrix[i][j] = a1;
                        matrix[n-1-i][j] = a1;
                        matrix[i][n-1-j] = a1;
                        matrix[n-i-1][n-j-1] = a1;
                    }
                    k+=4;
                }
            }
            System.out.println("Yes");
            for(int i = 0; i < n ; i++)
            {
                for(int j = 0; j < n; j++)
                {
                    System.out.print(matrix[i][j]);
                    System.out.print(" ");
                }
                System.out.println();
            }
            return;
        }
        else
        {
            int k = 0;
            int spElem = 0;
            boolean spFound = false;
            boolean failed = false;

            int centerRowInd = 0;
            int centerColumnInd = 0;
            boolean centerRowFinished = false;
            boolean centerColumnFinished = false;

            for(int i = 0; i < n/2; i++)
            {
                for(int j = 0; j < n/2; j++) {
                    int a1 = a[k];
                    int a2 = a[k + 1];
                    int a3 = a[k + 2];
                    int a4 = a[k + 3];
                    if(a1==a2 && a2 == a3 && a3==a4)
                    {
                        matrix[i][j] = a1;
                        matrix[n-1-i][j] = a1;
                        matrix[i][n-1-j] = a1;
                        matrix[n-i-1][n-j-1] = a1;
                        k+=4;
                    }
                    else if(a1==a2)
                    {
                        if(false == centerRowFinished)
                        {
                            matrix[n/2][centerRowInd] = a1;
                            matrix[n/2][n-1-centerRowInd] = a1;
                            centerRowInd++;
                            if(centerRowInd == n/2)
                            {
                                centerRowFinished = true;
                            }
                        }
                        else if(false == centerColumnFinished)
                        {
                            matrix[centerColumnInd][n/2] = a1;
                            matrix[n-1-centerColumnInd][n/2] = a1;
                            centerColumnInd++;
                            if(centerColumnInd == n/2)
                            {
                                centerColumnFinished = true;
                            }
                        }
                        else
                        {
                            failed = true;
                        }
                        k+=2;
                        j-=1;
                    }
                    else if(a1!=a2)
                    {
                        if(false == spFound) {
                            k = k + 1;
                            spElem = a1;
                            spFound = true;
                            j-=1;
                        }
                        else
                        {
                            failed = true;
                        }
                    }
                    if(failed) {
                        System.out.println("No");
                        return;
                    }
                }
            }
            for(int i = centerRowInd; i < n/2; i++) {
                int a1 = a[k];
                int a2 = a[k + 1];
                if (a1 != a2) {
                    if (false == spFound) {
                        k = k + 1;
                        spElem = a1;
                        spFound = true;
                        a1 = a[k + 1];
                        if (a1 != a2) {
                            failed = true;
                        }
                        matrix[n / 2][i] = a1;
                        matrix[n / 2][n - 1 - i] = a1;
                    } else {
                        failed = true;
                    }
                } else {
                    matrix[n / 2][i] = a1;
                    matrix[n / 2][n - 1 - i] = a1;
                }
                k += 2;
                if (failed) {
                    System.out.println("No");
                    return;
                }
            }
            for(int i = centerColumnInd; i < n/2; i++) {
                int a1 = a[k];
                int a2 = a[k + 1];
                if (a1 != a2) {
                    if (false == spFound) {
                        k = k + 1;
                        spElem = a1;
                        spFound = true;
                        a1 = a[k + 1];
                        if (a1 != a2) {
                            failed = true;
                        }
                        matrix[i][n/2] = a1;
                        matrix[n - 1 - i][n/2] = a1;
                    } else {
                        failed = true;
                    }
                } else {
                    matrix[i][n/2] = a1;
                    matrix[n - 1 - i][n/2] = a1;
                }
                k += 2;
                if (failed) {
                    System.out.println("No");
                    return;
                }
            }
            if(false == spFound)
            {
                matrix[n/2][n/2] = a[squareN - 1];
            }
            else
            {
                matrix[n/2][n/2] = spElem;
            }



            System.out.println("Yes");
            for(int i = 0; i < n ; i++)
            {
                for(int j = 0; j < n; j++)
                {
                    System.out.print(matrix[i][j]);
                    System.out.print(" ");
                }
                System.out.println();
            }
            return;
        }
    }
}