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.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Stack;

public class ProblemC {
	
	static HashMap<Integer, Integer> times = new HashMap<>();
	static int onces = 1;
	static double twoces = 0;
	static double fources = 0;
	static int[] four;
	static Integer fourIndex = 0;
	static Integer twoIndex = 0;
	static int[] two;
	static int one;
	static String[] lvls;
	static boolean mid;
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    int k = Math.multiplyExact(n, n);
	    int number;
	    
	    if (n == 1) {
	    	System.out.println("YES");
	    	System.out.println(in.nextInt());
	    	in.close();
	    	return;
	    }
	    
	    for (int i = k; i > 0; i--) {
	    	number = in.nextInt();
	    	if (times.containsKey(number))
	    		times.put(number, times.get(number) + 1);
	    	else
	    		times.put(number, 1);
	    }
	    
	    in.close();
	    
	    fources = Math.pow(n/2, 2);
	    four = new int[(int) fources];
	    lvls = new String[n/2];
	    mid = n % 2 == 1;
	    if (mid) {
	    	twoces = n - 1;
	    	two = new int[(int) twoces];
	    }
	    
	    
	    times.entrySet().stream().sorted(Map.Entry.comparingByValue()).allMatch((entry) -> {
	    	int left = entry.getValue();
	    	int times = Math.floorDiv(left, 4);
	    	
	    	
	    		
	    	fources -= times;
	    	left %= 4;
	    	
    		if (fources < 0) {
    			int subs = (int) (fources * -1 * 2);
    			twoces -= subs;
    			times += fources;
    			move(entry.getKey(), four, fourIndex, times, false);
    			move(entry.getKey(), two, twoIndex, subs, true);
    			fources = 0;
    		} else
    			move(entry.getKey(), four, fourIndex, times, false);
	    	
	    	if (left >= 2) {
	    		twoces--;
	    		left -= 2;
	    		if (twoces < 0) {
	    			System.out.println("NO");

	    			return false;
	    		}
    			move(entry.getKey(), two, twoIndex, 1, true);
	    	}
	    	
	    	if (left == 1) {
	    		onces--;
	    		if (onces < 0) {
	    			System.out.println("NO");

	    			return false;
	    		}
	    		one = entry.getKey();
	    	}
	    	return true;
	    	
	    });
	    
	    if (!(onces < 0 || twoces < 0 || fources < 0)) {
	    	System.out.println("YES");
		    
		    fourIndex = 0;
		    twoIndex = 0;
		    
		    printMatrix(0);
		    
		    if (mid) {
		    	StringBuilder sb = new StringBuilder();
				Stack<Integer> numbers = new Stack<>();
				for (int i = lvls.length; i > 0; i--) {
					sb.append(two[twoIndex] + " ");
					numbers.push(two[twoIndex]);
					twoIndex++;
				}
				sb.append(one + " ");
				for (int i = lvls.length; i > 0; i--) 
					sb.append(numbers.pop() + " ");
				System.out.println(sb.toString());
		    }
		    
		    for (int i = lvls.length - 1; i >= 0; i--) {
		    	System.out.println(lvls[i]);
		    }
	    }
	}
	
	private static void move(int key, int[] arr, int index, int times, boolean dos) {
		for (int i = times; i>0; i--) {
			arr[index] = key;
			if (dos)
				index = ++twoIndex;
			else
				index = ++fourIndex;
		}
	}
	
	private static void printMatrix(int lvl) {
		if (lvl == lvls.length)
			return;
		StringBuilder sb = new StringBuilder();
		Stack<Integer> numbers = new Stack<>();
		for (int i = lvls.length; i > 0; i--) {
			sb.append(four[fourIndex] + " ");
			numbers.push(four[fourIndex]);
			fourIndex++;
		}
		if (mid) {
			sb.append(two[twoIndex] + " ");
			twoIndex++;
		}
		
		for (int i = lvls.length; i > 0; i--) 
			sb.append(numbers.pop() + " ");
		
		lvls[lvl] = sb.toString();
		System.out.println(lvls[lvl]);
		printMatrix(lvl + 1);
	}
}