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:
/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
public class Boss {
	public static void main (String[] args) {
	    int max=0;
	    Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    int a[]=new int[n*n];
	    int c[]=new int[1005];
	    int i;
	    long sum=0;
	    for(i=0;i<n*n;i++)
	    {
	    	a[i]=sc.nextInt();
	    	c[a[i]]++;
	    	//System.out.println(c[a[i]]);
	    }
	    if(n%2==0)
	    {
	    	int req=(n*n)/4;
	    	int r[]=new int[req];
	    	int s=0;
	    	for(i=0;i<c.length;i++)
	    	{
	    		if(c[i]>=4)
	    		{
	    			//System.out.println(c[i]);
	    			int x=c[i]/4;
	    			for(int j=0;j<x;j++)
	    			{
	    				r[s]=i;
	    				s++;
	    			}
	    			req=req-x;
	    		}
	    	}
	    	//System.out.println(req);
	    	if(req!=0)
	    		System.out.println("NO");
	    	else
	    	{
	    		System.out.println("YES");
	    		int ans[][]=new int[n][n];
	    		int p=0;
	    			for(int k=0;k<n/2;k++)
	    			{
	    				for(int l=0;l<n/2;l++)
	    				{
	    					ans[k][l]=r[p];
	    					ans[k][n-l-1]=r[p];
	    					ans[n-k-1][l]=r[p];
	    					ans[n-k-1][n-l-1]=r[p];
	    					p++;
	    				}
	    			}
	    			for(int k=0;k<n;k++)
	    			{
	    				for(int l=0;l<n;l++)
	    				{
	    					System.out.print(ans[k][l]+" ");
	    				}
	    				System.out.println();
	    			}
	    	}
	    }
	    else
	    {
	    	n--;
	    	int req4=(n*n)/4;
	    	int req2=n;
	    	n++;
	    	int r[]=new int[req4];
	    	int r2[]=new int[req2];
	    	int s=0;
	    	int s2=0;
	    	for(i=0;i<c.length&&req4>0;i++)
	    	{
	    		if(c[i]>=4)
	    		{
	    			int x=c[i]/4;
	    			if(x>req4)
	    			{
	    				for(int j=0;j<req4;j++)
		    			{
		    				r[s]=i;
		    				s++;
		    			}
		    			c[i]=c[i]-req4*4;
		    			req4=0;
	    			}
	    			else {
		    			for(int j=0;j<x;j++)
		    			{
		    				r[s]=i;
		    				s++;
		    			}
		    			req4=req4-x;
		    			c[i]=c[i]%4;
	    			}
	    		}
	    	}
	    	for(i=0;i<c.length&&req2>0;i++)
	    	{
	    		int x=c[i]/2;
    			for(int j=0;j<x;j++)
    			{
    				r2[s2]=i;
    				s2++;
    			}
    			req2=req2-x;
    			c[i]=c[i]%2;
	    	}
	    	int one=0;
	    	for(i=0;i<c.length;i++)
	    	{
	    		if(c[i]>0)
	    		{
	    			one=i;
	    		}
	    	}
	    	if(req4!=0||req2!=0)
	    		System.out.println("NO");
	    	else
	    	{
	    		System.out.println("YES");
	    		int ans[][]=new int[n][n];
	    		int p=0;
	    			for(int k=0;k<n/2;k++)
	    			{
	    				for(int l=0;l<n/2;l++)
	    				{
	    					ans[k][l]=r[p];
	    					ans[k][n-l-1]=r[p];
	    					ans[n-k-1][l]=r[p];
	    					ans[n-k-1][n-l-1]=r[p];
	    					p++;
	    				}
	    			}
	    			int q=0;
	    			int cons=n/2;
	    			for(int k=0;k<n/2;k++)
	    			{
	    				ans[cons][k]=r2[q];
	    				ans[cons][n-k-1]=r2[q];
	    				q++;
	    			}
	    			for(int k=0;k<n/2;k++)
	    			{
	    				ans[k][cons]=r2[q];
	    				ans[n-k-1][cons]=r2[q];
	    				q++;
	    			}
	    			ans[cons][cons]=one;
	    			for(int k=0;k<n;k++)
	    			{
	    				for(int l=0;l<n;l++)
	    				{
	    					System.out.print(ans[k][l]+" ");
	    				}
	    				System.out.println();
	    			}
	    	}
	    }
	   // System.out.print("");
	}
}