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.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
import java.util.stream.IntStream;

public class c {

	static class Solver {

		int N, mat[][], vals[], f[];
		ArrayDeque<int[][]> fours, twos, ones;
		
		void solve(FastScanner s, PrintWriter out) {
			N = s.nextInt(); vals = s.nextIntArray(N * N);
			f = new int[1001]; for(int x : vals) f[x]++;
			PriorityQueue<Integer> q = new PriorityQueue<>((a, b) -> f[b] - f[a]);
			IntStream.range(1, 1001).forEach(x -> q.add(x));
			
			fours = new ArrayDeque<>(); twos = new ArrayDeque<>(); ones = new ArrayDeque<>();
			for(int i = 0, ii = N - 1; i < N / 2; i++, ii--)
				for(int j = 0, jj = N - 1; j < N / 2; j++, jj--)
					fours.add(new int[][] { { i, j }, { ii, j }, { i, jj }, { ii, jj } });
			
			if(N % 2 == 1) {
				for(int i = 0, ii = N - 1, j = N / 2; i < N / 2; i++, ii--) {
					twos.add(new int[][] { { i, j }, { ii, j } });
					twos.add(new int[][] { { j, i }, { j, ii } });
				}
				ones.add(new int[][] { { N / 2, N / 2 } });
			}
			
			int cur, cf; mat = new int[N][N];
			assign: while(!q.isEmpty()) {
				if((cf = f[cur = q.poll()]) == 0) break;
				put4: if(cf >= 4) {
					if(fours.isEmpty()) break put4;
					for(int[] a : fours.poll())
						mat[a[0]][a[1]] = cur;
					f[cur] -= 4; q.add(cur); continue assign;
				}
				
				put2: if(cf >= 2) {
					if(twos.isEmpty()) break put2;
					for(int[] a : twos.poll())
						mat[a[0]][a[1]] = cur;
					f[cur] -= 2; q.add(cur); continue assign;
				}
				
				put1: if(cf >= 1) {
					if(ones.isEmpty()) break put1;
					for(int[] a : ones.poll())
						mat[a[0]][a[1]] = cur;
					f[cur] -= 1; q.add(cur); continue assign;
				}
				
				out.println("NO"); return;
			}
			
			out.println("YES");
			for(int[] row : mat) {
				for(int v : row) out.print(v + " ");
				out.println();
			}
				
		}
		
		String debug(Object ... o) { return Arrays.deepToString(o); }

	}

	public static void main(String[] args) {
		FastScanner s = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		new Solver().solve(s, out);
		out.close();
		s.close();
	}

	static class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1 << 22];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
		}

		public FastScanner(File f) throws FileNotFoundException {
			this(new FileInputStream(f));
		}

		public FastScanner(String s) {
			this.stream = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
		}

		void close() {
			try {
				stream.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

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

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

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

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}

		public int[] nextIntArray(int N) {
			int[] ret = new int[N];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextInt();
			return ret;
		}

		public int[][] next2DIntArray(int N, int M) {
			int[][] ret = new int[N][];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextIntArray(M);
			return ret;
		}

		public long[] nextLongArray(int N) {
			long[] ret = new long[N];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextLong();
			return ret;
		}

		public long[][] next2DLongArray(int N, int M) {
			long[][] ret = new long[N][];
			for (int i = 0; i < N; i++)
				ret[i] = nextLongArray(M);
			return ret;
		}

		public double[] nextDoubleArray(int N) {
			double[] ret = new double[N];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextDouble();
			return ret;
		}

		public double[][] next2DDoubleArray(int N, int M) {
			double[][] ret = new double[N][];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextDoubleArray(M);
			return ret;
		}

	}

}