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

public class PalindromicMatrix {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int arr[] = new int[n * n];
		int centerAxis = 0;
		int center = 0;
		boolean t = false;
		boolean notfour = false;
		int num = 0;
		LinkedList<Integer> distinct[] = new LinkedList[1001];

		int xyAxes[][] = new int[(n / 2) * (n / 2)][2];
		int xy = 0;
		for (int x = 0; x < n / 2; x++) {
			for (int y = 0; y < n / 2; y++) {
				xyAxes[xy][0] = x;
				xyAxes[xy][1] = y;
				xy++;
				// System.err.print(x);
				// System.err.print(y);
				// System.out.println();
			}

		}
		for (int i = 0; i < (n * n); i++) {// for reading array
			arr[i] = s.nextInt();

		}
		for (int i = 0; i < distinct.length; i++) {
			distinct[i] = new LinkedList<Integer>();
		}
		for (int i = 0; i < n * n; i++) {
			distinct[arr[i]].add(arr[i]);
		}
		int c = 0;
		int numfours =0;
		for (int i = 0; i < distinct.length; i++) {
			if (distinct[i].size() % 4 == 0 && distinct[i].size() > 0) {
				c++;
				numfours+= distinct[i].size()/4;
				num += distinct[i].size();
			} else if (distinct[i].size() % 4 != 0) {
				notfour = true;
				if (distinct[i].size() % 2 == 0){
					centerAxis += distinct[i].size();
					numfours+= (distinct[i].size()-2)/4;
				}
				if (distinct[i].size() % 2 == 1){
					numfours+= (distinct[i].size()-1)/4;
				}
			}

			if (distinct[i].size() % 2 == 1) {
				center++;
				centerAxis += distinct[i].size();
			}
		}

		if (n % 2 == 1 && (centerAxis + num == (n * n)) && center == 1 && numfours>=((n/2)*(n/2)))
			t = true;
		if (numfours>=((n/2)*(n/2)) && center == 0 && n % 2 == 0 && !notfour)
			t = true;

		int out[][] = new int[n][n];
		if (t) {
			System.out.println("Yes");
			int x = 0;
			int y = 0;
			int axisCounter = 0;
			for (int i = 1; i < distinct.length; i++) {
				if (distinct[i].size() % 2 == 1) {
					out[n / 2][n / 2] = distinct[i].getFirst();
					distinct[i].remove();

				}
				while (distinct[i].size() >= 4
						&& ((x <= (n / 2) - 1 && y <= (n / 2) - 1))
						&& axisCounter < xyAxes.length) {
					{

						if (distinct[i].size() % 4 == 0
								&& distinct[i].size() > 0) {
							if (out[x][y] == 0) {

								out[x][y] = distinct[i].getFirst();

								// across x-axis
								out[x][n - y - 1] = distinct[i].getFirst();

								// across y-axis

								out[n - x - 1][n - y - 1] = distinct[i]
										.getFirst();

								// across the origin
								out[n - x - 1][y] = distinct[i].getFirst();
								distinct[i].remove();
								distinct[i].remove();
								distinct[i].remove();
								distinct[i].remove();
							}
							axisCounter++;
							if (axisCounter < xyAxes.length) {
								x = xyAxes[axisCounter][0];
								y = xyAxes[axisCounter][1];
							}

						} else if (distinct[i].size() % 2 == 0
								&& distinct[i].size() >= 4) {
							if (out[x][y] == 0) {
								out[x][y] = distinct[i].getFirst();

								// across x-axis
								out[x][n - y - 1] = distinct[i].getFirst();

								// across y-axis
								out[n - x - 1][n - y - 1] = distinct[i]
										.getFirst();

								// across the origin
								out[n - x - 1][y] = distinct[i].getFirst();
								distinct[i].remove();
								distinct[i].remove();
								distinct[i].remove();
								distinct[i].remove();
							}
							axisCounter++;
							if (axisCounter < xyAxes.length) {
								x = xyAxes[axisCounter][0];
								y = xyAxes[axisCounter][1];
							}

						}  
					}

				}

			}
			// x=n/2 ;
			// y=0;
			int centerAxes[][] = new int[(2 * n - 2)/2][2];
			x = n / 2;
			y = 0;
			int k = 0;
			for (int j = 0; j < centerAxes.length / 2; j++) {
			
				centerAxes[k][0] = x;
				centerAxes[k][1] = y;
				y++;
				k++;
			}
			y = n / 2;
			x = 0;
			k = (2 * n - 2) / 4;
			for (int j = 0; j < centerAxes.length / 2; j++) {
				
				centerAxes[k][0] = x;
				centerAxes[k][1] = y;
				x++;
				k++;
			}
			// for (int j = 0; j < centerAxes.length; j++) {
			// System.err.print(centerAxes[j][0]);
			// System.err.print(centerAxes[j][1]);
			// }
			if (n % 2 == 1) {
				axisCounter = 0;
				for (int i = 1; i < distinct.length; i++) {
					while (distinct[i].size() > 0 && axisCounter < centerAxes.length) {
						x = centerAxes[axisCounter][0];
						y = centerAxes[axisCounter][1];
						out[x][y] = distinct[i].getFirst();
						distinct[i].remove();
						if(x== n/2)
						{	out[x][n-y-1] = distinct[i].getFirst();
						distinct[i].remove();}
						else{
							out[n-x-1][y] = distinct[i].getFirst();
							distinct[i].remove();
						}
						axisCounter++;
					}
				}
			}
		} else
			System.out.println("No");
		if (t)
			for (int i = 0; i < out.length; i++) {
				for (int j = 0; j < out[i].length; j++) {
					// if(out[i][j]==0) System.out.print(578 + " "); else
					System.out.print(out[i][j] + " ");
				}
				System.out.println();
			}
	}
}