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;
// ACCEPTED
public class PalindromicMatrix {
	public static int n=0;
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
	    n = scn.nextInt();
		HashMap<Integer, Integer> hmap = new HashMap<>();
		int[] arr = new int[n * n];
		for (int i = 0; i < n * n; i++) {
			int x = scn.nextInt();
			if (hmap.containsKey(x)) {
				hmap.put(x, hmap.get(x) + 1);
			} else {
				hmap.put(x, 1);
			}
		}
		HashMap<Integer, ArrayList<Integer>> freq = new HashMap<>();
		Set<Integer> set = hmap.keySet();
		int flag = 0;
		for (int s : set) {
			int x = hmap.get(s);
			if (x >= 4) {
				if (freq.containsKey(4)) {
					ArrayList<Integer> al = freq.get(4);
					al.add(s);
					freq.put(4, al);
				} else {
					ArrayList<Integer> al = new ArrayList<>();
					al.add(s);
					freq.put(4, al);
				}
			} else if (x != 1) {
				if (freq.containsKey(2)) {
					ArrayList<Integer> al = freq.get(2);
					al.add(s);
					freq.put(2, al);
				} else {
					ArrayList<Integer> al = new ArrayList<>();
					al.add(s);
					freq.put(2, al);
				}
			} else {
				if (freq.containsKey(1)) {
					ArrayList<Integer> al = freq.get(1);
					al.add(s);
					freq.put(1, al);
				} else {
					ArrayList<Integer> al = new ArrayList<>();
					al.add(s);
					freq.put(1, al);
				}
			}
		}
		int mid = (n * n) / 2;
		if ((n * n) % 2 != 0) {
			mid += 1;
		}
		// System.out.println(freq+" "+hmap);
		for (int j = 0, start = 0; j < n && start < mid; j++) {
		// System.out.println(start + " " + j + " " + (n / 2) + " " + mid + " " + freq+"  "+hmap);
			if (freq.containsKey(4)) {
				if (n % 2 != 0 && j == n / 2) {
					if (freq.containsKey(2)) {
						solve(freq,hmap,2,2,start,j,arr);
						j = -1;
						start = n + start;
					} else {
						solve(freq,hmap,4,2,start,j,arr);
						j = -1;
						start = n + start;
					}
				} else {					
					solve(freq,hmap,4,4,start,j,arr);
					if (n % 2 == 0 && j == n / 2 - 1) {
						j = -1;
						start = n + start;
					}
				}
			} else if (freq.containsKey(2)) {
				if (n % 2 != 0 && j != n / 2 && start + j >= (n / 2) * n) {
					solve(freq,hmap,2,2,start,j,arr);
				} else if (n % 2 != 0 && j == n / 2) {
					solve(freq,hmap,2,2,start,j,arr);
					j = -1;
					start = n + start;
				} else {
					flag = 1;
					break;
				}
			} else {
				if (freq.containsKey(1)) {
					if (n % 2 != 0) {
						if (j + start == (n * n) / 2) {
							arr[j + start] = freq.get(1).get(freq.get(1).size() - 1);
						} else {
							flag = 1;
						}
					} else {
						flag = 1;
					}
					break;
				} else {
					flag = 1;
					break;
				}
			}
		}
		if (flag == 1) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
			int[][] a = new int[n][n];
			for (int i = 0, k = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					a[j][i] = arr[k];
					k++;
				}
			}
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					System.out.print(a[i][j] + " ");
				}
				System.out.println();
			}
		}
	}
	public static void solve(HashMap<Integer,ArrayList<Integer>> freq,HashMap<Integer,Integer> hmap,int x,int sub,int start,int j,int []arr) {
		ArrayList<Integer> al=freq.get(x);
		int y = al.get(al.size() - 1);// last element in the Arraylist corresponding to n
		int rem_freq = hmap.get(y);
		if(sub==2&&n % 2 != 0 &&j==n/2) {
			arr[start + j] = y;
			if (n * n - (start + j) - 1 > start + j)
			arr[n * n - (start + j) - 1] = y;
			rem_freq-=sub;
		}else if(sub==2&&n % 2 != 0 &&j!=n/2&& start + j >= (n / 2) * n) {
			arr[start + j] = y;
			arr[start + n - j - 1] = y;
			rem_freq-=sub;
		}
			else if(sub==4) {
			arr[start + j] = y;
			arr[start + n - j - 1] = y;
			if (n * n - (start + j) - 1 != start + n - j - 1) {
				arr[n * n - (start + n - j - 1) - 1] = y;
				arr[n * n - (start + j) - 1] = y;
				rem_freq -= sub;
			} else {
				rem_freq -= 2;
			}
		}
		hmap.put(y, rem_freq);
		//System.out.println(rem_freq);
		if (rem_freq == 1) {
			if (freq.containsKey(1)) {
				freq.get(1).add(freq.get(x).get(al.size() - 1));
			} else {
				ArrayList<Integer> a = new ArrayList<Integer>();
				//System.out.println(x+" "+freq.get(x)+" "+freq);
				a.add(freq.get(x).get(al.size() - 1));
				freq.put(1, a);
			}
		} else if (rem_freq < x && rem_freq>1) {
			if (freq.containsKey(2)) {
				freq.get(2).add(freq.get(x).get(al.size() - 1));
			} else {
				ArrayList<Integer> a = new ArrayList<Integer>();
				a.add(freq.get(x).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);
		} 
	}
}