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.HashMap;
import java.util.Scanner;
import java.util.Set;

public class PalindromicMatrix_Improved_Implementation {
	static int n = 0;

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		n = scn.nextInt();
		int[] arr = new int[n * n];
		HashMap<Integer, Integer> hmap = new HashMap<>();
		HashMap<Integer, ArrayList<Integer>> freq = new HashMap<>();
		for (int i = 0; i < n * n; i++) {
			arr[i] = scn.nextInt();
			if (hmap.containsKey(arr[i])) {
				hmap.put(arr[i], hmap.get(arr[i]) + 1);
			} else {
				hmap.put(arr[i], 1);
			}
		}
		Set<Integer> set = hmap.keySet();
		for (int i : set) {
			int count = hmap.get(i);
			if (count >= 4) {
				addEle(freq, 4, i);
			} else if (count >= 2) {
				addEle(freq, 2, i);
			} else if (count == 1) {
				addEle(freq, 1, i);
			}
		}
		//System.out.println(hmap+" "+freq);
		int[][] ans = new int[n][n];
		int flag = 0;
		for (int i = 0; i < n / 2; i++) {
			for (int j = 0; j < n / 2; j++) {
				if (freq.containsKey(4)) {
					ArrayList<Integer> al = freq.get(4);
					solve(ans, i, j, al.get(al.size() - 1));
					updateFreq(freq, hmap, al,4,4);
				} else {
					flag = 1;
					break;
				}
			}
		}
//		for(int i=0;i<n;i++) {
//			for(int j=0;j<n;j++) {
//				System.out.print(ans[i][j]+" ");
//			}
//			System.out.println();
//		}
//		System.out.println("\n");
		if (flag == 1) {
			System.out.println("NO");
			
		} else {
			// if n is odd
			//System.out.println(freq);
			if (n % 2 != 0) {
				for(int i=n/2,j=0;j<=n/2;j++) {
//					System.out.println(freq+" "+i+" "+j);
//					System.out.println(freq+" "+hmap);

					if(j==n/2&&freq.containsKey(1)) {
						ArrayList<Integer> al = freq.get(1);
						ans[i][j]=al.get(al.size()-1);
						updateFreq(freq, hmap, al,1,1);
						//System.out.println("uu");
					}
						else if(freq.containsKey(2)) {
							ArrayList<Integer> al = freq.get(2);
							ans[i][j]=ans[i][n-1-j]=al.get(al.size()-1);
							if(j==n/2)
							updateFreq(freq, hmap, al,2,1);
							else{
								updateFreq(freq, hmap, al,2,2);

							};
						}
						else if(freq.containsKey(4)) {
							ArrayList<Integer> al = freq.get(4);
							ans[i][j]=ans[i][n-1-j]=al.get(al.size()-1);
							if(j==n/2)
								updateFreq(freq, hmap, al,4,1);
								else{
									updateFreq(freq, hmap, al,4,2);

								};

						}
						else {
							//System.out.println(i+" ggg "+j);
							flag=1;
							break;
						}
					
				}
				for(int i=0,j=n/2;i<n/2;i++) {
					//System.out.println(freq);
						if(freq.containsKey(4)) {
							//System.out.println("4e4");
							ArrayList<Integer> al = freq.get(4);
							ans[i][j]=ans[n-1-i][j]=al.get(al.size()-1);
							updateFreq(freq, hmap, al,4,2);
						}
						else if(freq.containsKey(2)) {
							//System.out.println("2w");
							ArrayList<Integer> al = freq.get(2);
							ans[i][j]=ans[n-1-i][j]=al.get(al.size()-1);
							updateFreq(freq, hmap, al,2,2);
						}
//						else if(freq.containsKey(1)) {
//							//System.out.println("1q");
//							ArrayList<Integer> al = freq.get(1);
//							ans[i][j]=ans[n-1-i][j]=al.get(al.size()-1);
//							updateFreq(freq, hmap, al,1,1);
//						}
						else {
							flag=1;
							break;
						}
				}
				
			}
			if(flag==1) {
				System.out.println("NO");
//				for(int i=0;i<n;i++) {
//					for(int j=0;j<n;j++) {
//						System.out.print(ans[i][j]+" ");
//					}
//					System.out.println();
//				}
			}else {
				System.out.println("YES");
				for(int i=0;i<n;i++) {
					for(int j=0;j<n;j++) {
						System.out.print(ans[i][j]+" ");
					}
					System.out.println();
				}
			}
		}
	}
	public static void updateFreq(HashMap<Integer, ArrayList<Integer>> freq, HashMap<Integer, Integer> hmap,
			ArrayList<Integer> al,int x,int sub) {
		//System.out.println(al.get(al.size()-1)+" "+al);
		int rem_freq = hmap.get(al.get(al.size() - 1)) - sub;
		hmap.put(al.get(al.size() - 1), rem_freq);
		if (rem_freq == 1) {
			if (freq.containsKey(1)) {
				freq.get(1).add(al.get(al.size() - 1));
			} else {
				ArrayList<Integer> a = new ArrayList<Integer>();
				a.add(al.get(al.size() - 1));
				freq.put(1, a);
			}
		} else if (rem_freq < x && rem_freq > 1) {
			if (freq.containsKey(2)) {
				freq.get(2).add(al.get(al.size() - 1));
			} else {
				ArrayList<Integer> a = new ArrayList<Integer>();
				a.add(al.get(al.size() - 1));
				freq.put(2, a);
			}
		}
		if (rem_freq < x) {
			freq.get(x).remove(al.size() - 1);
			if (freq.get(x).size() == 0) {
				freq.remove(x);
			}
		}
	}

	public static void solve(int[][] ans, int start, int end, int val) {
		ans[start][end] = ans[start][n - 1 - end] = ans[n - 1 - start][end] = ans[n - 1 - start][n - 1 - end] = val;
	}

	public static void addEle(HashMap<Integer, ArrayList<Integer>> freq, int x, int s) {
		if (freq.containsKey(x)) {
			ArrayList<Integer> al = freq.get(x);
			al.add(s);
			freq.put(x, al);
		} else {
			ArrayList<Integer> al = new ArrayList<>();
			al.add(s);
			freq.put(x, al);
		}
	}
}