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.StringTokenizer;

public class Soln8 {

	final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	final PrintWriter pw = new PrintWriter(System.out);

	public static void main(String[] args) {

		Soln8 solution = new Soln8();
		solution.solve();
		solution.close();

	}

	void solve() {

		int n = readInt();
		int[] arr = readIntArr();

		int[] count = new int[1001];
		for (int i : arr) {
			count[i]++;
		}
		int[][] res = new int[20][20];
		for (int i = 0; i < n / 2; i++) {
			l: for (int k = 0; k < n / 2; k++) {
				for (int j = 0; j < 1001; j++) {
					if (count[j] >= 4) {

						count[j] -= 4;
						res[i][k] = j;
						res[n - i - 1][k] = j;
						res[i][n - k - 1] = j;
						res[n - i - 1][n - k - 1] = j;
						continue l;

					}
				}
				pw.println("NO");
				return;
			}
		}

		if (n % 2 == 1) {
			int mid = n  / 2;

			l: for (int i = 0; i < n / 2; i++) {
				for (int j = 0; j < 1001; j++) {
					if (count[j] >= 2) {
						count[j] -= 2;
						res[i][mid] = j;
						res[n - i - 1][mid] = j;
						continue l;

					}

				}
				pw.println("NO");
				return;
			}

			l: for (int i = 0; i < n / 2; i++) {
				for (int j = 0; j < 1001; j++) {
					if (count[j] >= 2) {
						count[j] -= 2;
						res[mid][i] = j;
						res[mid][n - i - 1] = j;
						continue l;

					}

				}
				pw.println("NO");
				return;
			}
			for (int i = 0; i < 1001; i++) {
				if (count[i] > 0) {
					res[mid][mid] = i;
					pw.println("YES");
					for (int j = 0; j < n; j++) {
						for (int k = 0; k < n; k++) {
							pw.print(res[j][k] + " ");
						}
						pw.println();
					}
					return;
				}
			}
			pw.println("NO");

		} else {
			pw.println("YES");
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					pw.print(res[j][k] + " ");
				}
				pw.println();
			}
		}

	}

	void close() {

		pw.close();

	}

	String readLine() {
		String line = null;
		try {
			line = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return line;

	}

	String readString() {
		return readLine();

	}

	public long readlong() {
		return Long.parseLong(readLine());
	}

	public int readInt() {
		return Integer.parseInt(readLine());
	}

	String[] stringArray() {

		StringTokenizer st = new StringTokenizer(readLine());
		int n = st.countTokens();
		String ret[] = new String[n];
		for (int i = 0; i < n; i++) {
			ret[i] = st.nextToken();
		}
		return ret;

	}

	public int[] readIntArr() {
		String[] str = stringArray();
		int arr[] = new int[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Integer.parseInt(str[i]);
		return arr;
	}

	public double[] readDoubleArr() {
		String[] str = stringArray();
		double arr[] = new double[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Double.parseDouble(str[i]);
		return arr;
	}

	public long[] readLongArr() {
		String[] str = stringArray();
		long arr[] = new long[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Long.parseLong(str[i]);
		return arr;
	}

	public double readDouble() {
		return Double.parseDouble(readLine());
	}
}