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.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class template {
	public static void main(String[] args) throws Exception {
		new template().run();
	}
	public void run() throws Exception {
		FastScanner f = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = f.nextInt();
		int[][] mat = new int[n][n];
		int[] cnts = new int[1001];
		for(int i = 0; i < n*n; i++) cnts[f.nextInt()]++;
		if(n % 2 == 0) {
			boolean works = true;
			for(int i : cnts) works = works && i % 4 == 0;
			if(!works) out.println("NO");
			else {
				int pos = 0;
				int m = n/2;
				for(int i = 0; i <= 1000; i++)
					for(int j = 0; j < cnts[i]; j+= 4) {
						mat[pos/m][pos%m] = mat[n-1-pos/m][pos%m] = mat[pos/m][n-1-pos%m] = mat[n-1-pos/m][n-1-pos%m] = i;
						pos++;
					}
				out.println("YES");
				for(int[] i : mat) {
					for(int j : i) out.print(j + " ");
					out.println();
				}
			}
		} else {
			boolean works = true;
			LinkedList<Integer> _1 = new LinkedList<>();
			LinkedList<Integer> _2 = new LinkedList<>();
			LinkedList<Integer> _4 = new LinkedList<>();
			for(int i = 0; i <= 1000; i++) {
				if(cnts[i] == 0) continue;
				if(cnts[i] % 2 == 1) _1.add(i);
				else if(cnts[i] % 4 == 0) _4.add(i);
				else _2.add(i);
			}
			if(_1.size() != 1) out.println("NO");
			else {
				int _1val = _1.get(0);
				mat[n/2][n/2] = _1val;
				if(--cnts[_1val] != 0) {
					if(cnts[_1val] % 4 == 0) _4.add(_1val);
					else _2.add(_1val);
				}
				if(_2.size() > (n-1)*2 || _2.size() % 2 != (n-1) % 2) out.println("NO");
				else {
					for(int i = 0; i < (n-1)/2; i++) {
						if(_2.size() == 0) {
							int val = _4.pollFirst();
							_2.add(val);
							mat[n/2][i] = mat[n/2][n-i-1] = val;
							cnts[val] -= 2;
						} else {
							int val = _2.pollFirst();
							if(cnts[val] != 2)
								_4.add(val);
							cnts[val] -= 2;
							mat[n/2][i] = mat[n/2][n-i-1] = val;
						}
					}
					for(int i = 0; i < (n-1)/2; i++) {
						if(_2.size() == 0) {
							int val = _4.pollFirst();
							_2.add(val);
							mat[i][n/2] = mat[n-i-1][n/2] = val;
							cnts[val] -= 2;
						} else {
							int val = _2.pollFirst();
							if(cnts[val] != 2)
								_4.add(val);
							cnts[val] -= 2;
							mat[i][n/2] = mat[n-i-1][n/2] = val;
						}
					}
					if(_2.size() != 0) out.println("NO");
					else {
						int pos = 0;
						int m = n/2;
						for(int i : _4)
							for(int j = 0; j < cnts[i]; j+= 4) {
								mat[pos/m][pos%m] = mat[n-1-pos/m][pos%m] = mat[pos/m][n-1-pos%m] = mat[n-1-pos/m][n-1-pos%m] = i;
								pos++;
							}
						out.println("YES");
						for(int[] i : mat) {
							for(int j : i) out.print(j + " ");
							out.println();
						}
					}
				}
			}
		}
		out.flush();
	}
    static class FastScanner {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public FastScanner() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
        	return Long.parseLong(next());
        }
        public double nextDouble() {
        	return Double.parseDouble(next());
        }
        public String nextLine() {
        	try {
        		return reader.readLine();
        	} catch(IOException e) {
        		throw new RuntimeException(e);
        	}
        }
    }
}