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

public class Main 
{
	static int judge;
    public static void main(String[] args)
    {
        Scanner s=new Scanner(System.in);
        judge=1;
        int[] input=new int[1000];
        int n=s.nextInt();
        int[][] output=new int[n][n];
        for(int a=0;a<n*n;a++)
        {
        	int temp=s.nextInt();
        	input[temp-1]++;
        }
        ArrayList<Data> arr=new ArrayList<Data>();
        for(int a=0;a<1000;a++)
        {
        	if(input[a]!=0)
        	{
        		arr.add(new Data(a+1,input[a]));
        	}
        }
        arr.sort(new MyComparator());
        if(n%2!=0)
        {
        	functionOnCenter(arr,output);
        	functionOnOthers(arr,output);
        	functionOnMiddle(arr,output);
        }
        else
        	functionOnOthers(arr,output);
        if(judge==1)
        {
        	System.out.println("YES");
        	 for(int a=0;a<n;a++)
             {
             	for(int b=0;b<n;b++)
             	{
             		System.out.print(output[a][b]+" ");
             	}
             	System.out.println();
             }
        }
        else
        	System.out.println("NO");
        s.close();
    }
    public static void functionOnCenter(ArrayList<Data> arr,int[][] output)
    {
    	int index=0;
    	int n=output.length;
    	int middle=n/2;
    	output[middle][middle]=arr.get(index).value;
		arr.get(index).count--;
		return;
    }
    public static void functionOnMiddle(ArrayList<Data> arr,int[][] output)
    {
    	int n=output.length;
    	int middle=n/2;
    	for(int a=0;a<middle;a++)
    	{
    		int index=getIndexByIncreasingOrder(arr);
    		if(index==-1)
    		{
    			judge=0;
    			break;
    		}
    		else
    		{
    			output[a][middle]=arr.get(index).value;
    			output[n-1-a][middle]=arr.get(index).value;
				arr.get(index).count-=2;
    		}
    	}
    	for(int a=0;a<middle&&judge==1;a++)
    	{
    		int index=getIndexByIncreasingOrder(arr);
    		if(index==-1)
    		{
    			judge=0;
    			break;
    		}
    		else
    		{
    			output[middle][a]=arr.get(index).value;
    			output[middle][n-1-a]=arr.get(index).value;
    			arr.get(index).count-=2;
    		}
    	}
    	return;
    }
    public static void functionOnOthers(ArrayList<Data> arr,int[][] output)
    {
    	int n=output.length;
    	int middle=n/2;
    	for(int a=0;a<middle&&judge==1;a++)
    	{
    		for(int b=0;b<middle;b++)
    		{
    			int index=getIndexByDecreasingOrder(arr);
    			if(index==-1)
    			{
    				judge=0;
    				break;
    			}
    			else
    			{
    				output[a][b]=arr.get(index).value;
    				output[a][n-1-b]=arr.get(index).value;
    				output[n-1-a][b]=arr.get(index).value;
    				output[n-1-a][n-1-b]=arr.get(index).value;
    				arr.get(index).count-=4;
    			}
    		}
    	}
    	return;
    }
    public static int getIndexByIncreasingOrder(ArrayList<Data> arr) 
    {
    	int result=-1;
    	for(int a=0;a<arr.size();a++)
    	{
    		if(arr.get(a).count>=2)
    		{
    			result=a;
    			break;
    		}
    	}
    	return result;
    }
    public static int getIndexByDecreasingOrder(ArrayList<Data> arr) 
    {
    	int result=-1;
    	for(int a=arr.size()-1;a>=0;a--)
    	{
    		if(arr.get(a).count>=4)
    		{
    			result=a;
    			break;
    		}
    	}
    	return result;
    }
}
class Data
{
	public int value;
	public int count;
	public int priority;
	Data(int value,int count)
	{
		this.value=value;
		this.count=count;
		if(count%2!=0)
			this.priority=0;
		else if(count%4==0)
			this.priority=400*count;
		else
			this.priority=count;
	}
}
class MyComparator implements Comparator<Data>
{
	@Override
	public int compare(Data arg0, Data arg1) 
	{
		return arg0.priority-arg1.priority;
	}
}