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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class CodeforcesFun {

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static int[][] makeMatrixEven(int[][] a, int size) {
		int[][] arr = new int[size * 2][size * 2];
		int newSize = size * 2;
		for (int i = 0; i <= size - 1; i++) {
			for (int j = 0; j <= size - 1; j++) {
				arr[i][j] = a[i][j];
				arr[newSize - i - 1][j] = a[i][j];
				arr[i][newSize - j - 1] = a[i][j];
				arr[newSize - i - 1][newSize - j - 1] = a[i][j];
			}
		}
		return arr;
	}

	public static int[][] makeMatrixOdd(int[][] a, int size) {
		int[][] arr = new int[size * 2 - 1][size * 2 - 1];
		int newSize = size * 2 - 1;
		for (int i = 0; i <= size - 2; i++) {
			for (int j = 0; j <= size - 2; j++) {
				arr[i][j] = a[i][j];
				arr[newSize - i - 1][j] = a[i][j];
				arr[i][newSize - j - 1] = a[i][j];
				arr[newSize - i - 1][newSize - j - 1] = a[i][j];
			}
		}

		for (int i = 0; i <= size - 1; i++) {
			arr[i][size - 1] = a[i][size - 1];
			arr[newSize - i - 1][size - 1] = a[i][size - 1];
			arr[size - 1][i] = a[size - 1][i];
			arr[size - 1][newSize - i - 1] = a[size - 1][i];
		}

		return arr;
	}

	public static void main(String[] args) {
		MyScanner myScanner = new MyScanner();
		PrintWriter printer = new PrintWriter(System.out, true);
		int n = myScanner.nextInt();
		int[] arr = new int[n * n];
		for (int i = 0; i <= n * n - 1; i++) {
			arr[i] = myScanner.nextInt();
		}
		Arrays.sort(arr);
//		System.out.println(Arrays.toString(arr));
		Stack<Integer> stack4 = new Stack<>();
		Stack<Integer> stack2 = new Stack<>();
		Stack<Integer> stack1 = new Stack<>();

		int curSpree = 1;
		int cur = arr[0];
		for (int i = 1; i <= n * n - 1; i++) {
			if (arr[i] == cur) {
				curSpree++;
			}

			else {
//				printer.print(curSpree);
				for (int j = 0; j <= curSpree / 4 - 1; j++) {
					stack4.push(cur);
//					printer.print(curSpree);
				}
				curSpree = curSpree % 4;

				for (int j = 0; j <= curSpree / 2 - 1; j++) {
					stack2.push(cur);
				}

				curSpree = curSpree % 2;

				if (curSpree > 0) {
					stack1.push(cur);
				}
				curSpree = 1;
			}
			cur = arr[i];
		}

//		printer.print(curSpree);
		if (curSpree > 0) {
			for (int j = 0; j <= curSpree / 4 - 1; j++) {
				stack4.push(cur);
//					printer.print(curSpree);
			}
			curSpree = curSpree % 4;

			for (int j = 0; j <= curSpree / 2 - 1; j++) {
				stack2.push(cur);
			}

			curSpree = curSpree % 2;

			if (curSpree > 0) {
				stack1.push(cur);
			}
		}

		int[][] newA = null;

		if (n % 2 == 0) {
			if (stack2.size() > 0 || stack1.size() > 0) {
				printer.print("NO");
			} else {
				int[][] arr1 = new int[n / 2][n / 2];
				for (int i = 0; i <= n / 2 - 1; i++) {
					for (int j = 0; j <= n / 2 - 1; j++) {
						arr1[i][j] = stack4.pop();
					}
				}
				newA = makeMatrixEven(arr1, n / 2);
				printer.println("YES");
				printMatrix(newA, printer, n);
			}
		} else {
			if (stack1.size() != 1) {
				printer.println("NO");
			} else {
				while (stack2.size() < (n / 2) * 2) {
					int q = stack4.pop();
					stack2.push(q);
					stack2.push(q);
				}


				if (stack2.size() != n / 2 * 2 && stack4.size() != n * 2 - (n / 2 * 2) - 1) {
					printer.println("NO");
				} else {
					int[][] arr1 = new int[n / 2 + 1][n / 2 + 1];
					for (int i = 0; i <= n / 2 - 1; i++) {
						for (int j = 0; j <= n / 2 - 1; j++) {
							arr1[i][j] = stack4.pop();
						}
					}
					arr1[n / 2][n / 2] = stack1.pop();

					for (int i = 0; i <= n / 2 - 1; i++) {
						arr1[n / 2][i] = stack2.pop();
						arr1[i][n / 2] = stack2.pop();
					}
					newA = makeMatrixOdd(arr1, n / 2 + 1);
					printer.println("YES");
					printMatrix(newA, printer, n);
				}
			}
		}


		/*printer.println(stack4.size());
		printer.println(stack2.size());
		printer.println(stack1.size());*/

		printer.flush();
	}

	public static void printMatrix(int[][] a, PrintWriter p, int n) {
		for (int i = 0; i <= n - 1; i++) {
			for (int j = 0; j <= n - 1; j++) {
				p.print(a[i][j] + " ");
			}
			p.println();
		}
	}
}