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

public class Solution{
    InputStream is;
    PrintWriter out;
    String INPUT = "";
    Random r = new Random();
    Scanner in=new Scanner(System.in);
    long mod=1000000007l;

    int getVal(int[] arr){
        for(int i=0;i<1001;i++){
            if(arr[i]>=4){
                arr[i]-=4;
                return i;
            }
        }
        return 0;
    }

    int get(int[] arr){
        for(int i=0;i<1001;i++){
            if(arr[i]>=2){
                arr[i]-=2;
                return i;
            }
        }
        return 0;
    }

    public void solve(){
        int n=ni();
        int[] arr=new int[1001];
        for(int i=0;i<n*n;i++){
            arr[ni()]+=1;
        }
        int[][] res=new int[n][n];
        for(int i=0;i<1001;i++){
            if(arr[i]%2==1 && n%2==1){
                res[n/2][n/2]=i;
                arr[i]-=1;
                break;
            }
        }
        if(n%2==0){
            for(int i=0;i<1001;i++){
                if(arr[i]%4 != 0){
                    out.println("NO");
                    return;
                }
            }
        }
        else{
            int count=0;
            int x=0,y=0;
            for(int i=0;i<1001;i++){
                x+=arr[i]/4;
                y+=(arr[i]%4 == 2 ? 1 : 0);
            }
            if(x<((n/2)*(n/2))){
                out.println("NO");
                return;
            }
            x-=((n/2)*(n/2));
            y+=(2*x);
            if(y!=(n-1)){
                out.println("NO");
                return;
            }
            for(int i=0;i<1001;i++){
                if(arr[i]%2 != 0){
                    out.println("NO");
                    return;
                }
                else if(arr[i]%4==2){
                    count+=1;
                }
            }
            if(count >= n){
                out.println("NO");
                return;
            }
        }

        for(int i=0;i<n/2;i++){
            for(int j=0;j<n/2;j++){
                int id=getVal(arr);
                res[i][j]=id;
                res[i][n-j-1]=id;
                res[n-i-1][j]=id;
                res[n-i-1][n-j-1]=id;
            }
        }

        if(n%2 != 0){
            int x=n/2;
            for(int i=0;i<n/2;i++){
                res[x][i]=res[x][n-i-1]=get(arr);
                res[i][x]=res[n-i-1][x]=get(arr);
            }
        }
        out.println("YES");
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                out.print(res[i][j]+" ");
            }
            out.println();
        }
    }
    public void run(){
        is = new DataInputStream(System.in);
        out = new PrintWriter(System.out);
        int t=1;while(t-- > 0)solve();
        out.flush();
    }
    public static void main(String[] args){new Solution().run();}
    //Fast I/O code is copied from uwi code.
    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;
    private int readByte(){
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }
    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }
    private String ns(){
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ 
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    private char[] ns(int n){
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }
    static int i(long n){
        return (int)Math.round(n);
    }
    private char[][] nm(int n, int m){
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }
    private int[] na(int n){
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }
    private int ni(){
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
    private long nl(){
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
    
}