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 matirx {
	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int[] freq=new int[1005];
		for(int i=0;i<n*n;i++) {
			freq[s.nextInt()]++;
		}
		int[] copy=Arrays.copyOf(freq, freq.length);
		//System.out.println(Arrays.toString(freq));
		boolean doable=true;
		int dubs=0;
		int quads=0;
		int singleUsed=-1;
		for(int i=0;i<1005;i++) {
			if(freq[i]%4==0) {quads++;continue;}
			if(freq[i]%4==2) {dubs++;continue;}
			if(freq[i]%2==1) {
				if(singleUsed==-1)singleUsed=i;
				else doable=false;
			}
		}
//		System.out.println(singleUsed);
		if(n%2==0&&singleUsed!=-1)doable=false;
		if(n%2==1&&singleUsed==-1)doable=false;
		
//		if(n%2==0&&dubs>0)doable=false;
//		if(n%2==1&&dubs>n-1)doable=false;
//		if(n%2==1&&(n-1-dubs)%2!=0)doable=false;
		
		if(!doable) {
			System.out.println("NO");
			return;
		}
		int[][] matrix=new int[n][n];
		if(singleUsed!=-1) {
			freq[singleUsed]--;
			matrix[n/2][n/2]=singleUsed;
		}
		
		if(n%2==1) {
			
			int curThing=0;
			//if its odds, go by the things with 2 left over and slot them in
			//curthing is the x or y middle line on an odd matrix
			
			outer: for(int i=0;i<1005;i++) {
				if(freq[i]%4==0)continue;
				if(freq[i]%2==0&&freq[i]>0) {
					int x=(curThing<n/2?n/2:curThing-n/2);
					int y=(curThing<n/2?curThing:n/2);
					if(curThing>=n-1)break outer;
					//System.out.println("curthing "+curThing+ "("+x+","+y+") " +i);
					
					matrix[y][x]=i;
					matrix[n-y-1][x]=i;
					matrix[y][n-x-1]=i;
					matrix[n-y-1][n-x-1]=i;
					freq[i]-=2;
					
					curThing++;
					i--;
				}
			}
//			for(int[] arr:matrix)System.out.println(Arrays.toString(arr));
			//go and fill in with things from a set of four. if only one of them was used(leaving 2 in freq) 
			outer: for(int i=0;i<1005;i++) {
				//if(freq[i]%4==0)continue;
				if(freq[i]%2==0&&freq[i]>0) {
					int x=(curThing<n/2?n/2:curThing-n/2);
					int y=(curThing<n/2?curThing:n/2);
					if(curThing>=n-1)break outer;
					//System.out.println("curthing "+curThing+ "("+x+","+y+") " +i);
					
					matrix[y][x]=i;
					matrix[n-y-1][x]=i;
					matrix[y][n-x-1]=i;
					matrix[n-y-1][n-x-1]=i;
					freq[i]-=2;
					
					curThing++;
					i--;
				}
			}
		}

//		for(int[] arr:matrix)System.out.println(Arrays.toString(arr));
		//go by the things with multiples of four, and slot them into the array. 
		int x=0;
		int y=0;
		outer: for(int i=0;i<1005;i++) {
			if(freq[i]%4==0&&freq[i]>0) {
			//	System.out.println("checking "+i +"("+x+","+y+")");
				matrix[y][x]=i;
				matrix[n-y-1][x]=i;
				matrix[y][n-x-1]=i;
				matrix[n-y-1][n-x-1]=i;
				freq[i]-=4;
				
				while(matrix[y][x]!=0) {
					x++;
					if(x>=n) {
						x=0;y++;
					}
					if(y>=n)break outer;
				}
				i--;
			}
		}

//		for(int[] arr:matrix)System.out.println(Arrays.toString(arr));
		//if result array contains a zero, we failed somewhere and it's not possible
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++)if(matrix[i][j]==0) {doable=false;break;}
		}
		
		if(!doable) {
			System.out.println("NO");
			return;
		}
		System.out.println("YES");
		
		
		for(int[] arr:matrix) {
			for(int xn:arr)System.out.print(xn+" ");
			System.out.println();
		}
		
		//redundant checks to see if the array i generated is invalid
		int[] freq2=new int[1005];
		for(int[] arr:matrix)for(int xn:arr)freq2[xn]++;
		
		x=0;
		y=0;
		while(y<n) {
			int thing=matrix[y][x];
			if(thing!=matrix[y][n-x-1])throw null;
			if(thing!=matrix[n-y-1][x])throw null;
			if(thing!=matrix[n-y-1][n-x-1])throw null;
			x++;
			if(x>=n) {
				x=0;
				y++;
			}
		}
		for(int i=0;i<copy.length;i++)if(copy[i]!=freq2[i])throw null;
	}
}