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.*;
public class CF{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int i,j;
		int arr[][]=new int[n][n];
		HashMap<Integer,Integer> freq=new HashMap<>(),four=new HashMap<>(),two=new HashMap<>(),one=new HashMap<>();
		for(i=0;i<n*n;i++){
			j=sc.nextInt();
			if(freq.containsKey(j)) freq.put(j,freq.get(j)+1);
			else freq.put(j,1);
		}
		for(Integer a:freq.keySet()){
			four.put(a,freq.get(a)/4);
			freq.put(a,freq.get(a)-4*(freq.get(a)/4));
			two.put(a,freq.get(a)/2);
			freq.put(a,freq.get(a)-2*(freq.get(a)/2));
			one.put(a,freq.get(a));
			//freq.put(a,freq.get(a)-freq.get(a)/4);
		}
		if(n%2==0){
			ArrayList<Integer> f=new ArrayList<Integer>();
			for(Integer a: four.keySet()){
			    //System.out.println(a+" "+four.get(a));
			    if(four.get(a)>0) f.add(a);
			}
			//System.out.println(f.get(0));
			int index=0;
			for(i=0;i<n/2;i++){
				for(j=0;j<n/2;j++){
					if(index==f.size()){
						System.out.println("NO");
						return;
					}
					arr[i][j]=f.get(index);
					arr[i][n-j-1]=f.get(index);
					arr[n-i-1][j]=f.get(index);
					arr[n-i-1][n-j-1]=f.get(index);
					four.put(f.get(index),four.get(f.get(index))-1);
					if(four.get(f.get(index))==0) index++;
				}
			}
			System.out.println("YES");
			for(i=0;i<n;i++){
				for(j=0;j<n;j++){
					System.out.print(arr[i][j]+" ");
				}
				System.out.println();
			}
		}
		else{
			ArrayList<Integer> f=new ArrayList<Integer>();
			for(Integer a: four.keySet()){
			    if(four.get(a)>0) f.add(a);
			}
			int index=0;
			/*for(Integer a: f){
			    System.out.println(a+" "+four.get(a));
			}*/
			for(i=0;i<n/2;i++){
				for(j=0;j<n/2;j++){
					if(index==f.size()){
						System.out.println("NO");
						return;
					}
					arr[i][j]=f.get(index);
					arr[i][n-j-1]=f.get(index);
					arr[n-i-1][j]=f.get(index);
					arr[n-i-1][n-j-1]=f.get(index);
					four.put(f.get(index),four.get(f.get(index))-1);
					if(four.get(f.get(index))==0) index++;
				}
			}
			for(Integer a:f){
			    //if(four.get(a)==0) continue;
				if(two.containsKey(a)){
					two.put(a,two.get(a)+2*four.get(a));
				}
				else two.put(a,four.get(a)*2);
			}
			ArrayList<Integer> t=new ArrayList<>();
			for(Integer a: two.keySet()){
			    if(two.get(a)>0) t.add(a);
			}
			index=0;
			for(i=0;i<n/2;i++){
				if(index==t.size()){
					System.out.println("NO");
					return;
				}
				arr[n/2][i]=t.get(index);
				arr[n/2][n-i-1]=t.get(index);
				two.put(t.get(index),two.get(t.get(index))-1);
				if(two.get(t.get(index))==0) index++;
			}
			for(i=0;i<n/2;i++){
				if(index==t.size()){
					System.out.println("NO");
					return;
				}
				arr[i][n/2]=t.get(index);
				arr[n-i-1][n/2]=t.get(index);
				two.put(t.get(index),two.get(t.get(index))-1);
				if(two.get(t.get(index))==0) index++;
			}
			t=new ArrayList<>();
			for(Integer a: one.keySet()){
			    if(one.get(a)>0) t.add(a);
			}
			if(t.size()!=1){
				System.out.println("NO");
				return;
			}
			arr[n/2][n/2]=t.get(0);
			System.out.println("YES");
			for(i=0;i<n;i++){
				for(j=0;j<n;j++){
					System.out.print(arr[i][j]+" ");
				}
				System.out.println();
			}
		}
	}
}