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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
		solver.solve(1, in, out);
        out.close();
    }
	
	

    static class Task {
		int n,temp,f,s;
		ArrayList<Integer> fours,sec,first;
		int[][] ans;
		
		public void cons(){
			ans=new int[n][n];
			f=0;
			s=0;
			for(int c1=0,c2=n-1;c1<=c2;c1++,c2--){
				for(int r1=0,r2=n-1;r1<=r2;r1++,r2--){
					
					if(r1!=r2 && c1!=c2){
						temp=fours.get(f++);
						ans[r1][c1]=temp;
						ans[r1][c2]=temp;
						ans[r2][c1]=temp;
						ans[r2][c2]=temp;
					}
					else if(r1==r2 && c1==c2 && r1==c2){
						ans[r1][c2]=first.get(0);
					}
					else if(r1 == r2){
						temp=sec.get(s++);
						ans[r1][c1]=temp;
						ans[r1][c2]=temp;
					}
					else if(c1 == c2){
						temp=sec.get(s++);
						ans[r1][c2]=temp;
						ans[r2][c1]=temp;
					}
					
				}
			}
			
		}
		
		
		public int solve(int testNumber, InputReader in, PrintWriter out) {
			n=in.nextInt();
			int[] count;
			count=new int[1001];
			fours=new ArrayList<Integer>();
			sec=new ArrayList<Integer>();
			first=new ArrayList<Integer>();
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					temp=in.nextInt();
					count[temp]++;
				}
			}
			
			for(int i=0;i<1001;i++){
				
				if(count[i] == 0 )
					continue;
				else if(count[i]%4==1){
					first.add(i);
				}
				else if(count[i]%4 == 2){
					sec.add(i);
				}
				else if(count[i]%4 == 3){
					sec.add(i);
					first.add(i);
				}
				temp=count[i]/4;
				while(temp!=0){
					fours.add(i);
					temp--;
				}
			}
			
			int fr,sr,ind;
			fr=(n/2)*(n/2);
			sr=(n/2)+(n/2);
			while(fours.size() > fr){
				ind=fours.size();
				temp=fours.get(ind-1);
				sec.add(temp);
				sec.add(temp);
				fours.remove(ind-1);
			}
			
			if(n%2==1){
				if(fours.size() == fr && sec.size() == sr && first.size() == 1){
					out.println("YES");
					cons();
				}
				else{
					out.println("NO");
					return 0;
				}
			}
			else{
				if(fours.size() == fr && sec.size() == 0 && first.size() == 0){
					out.println("YES");
					cons();
				}
				else{
					out.println("NO");
					return 0;
				}
			}
			
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					out.print(ans[i][j]+" ");
				}
				out.println();
			}
			
			return 0;
		}
	}
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 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());
        }

    }
}