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.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.io.*;
//import javafx.util.Pair;
import java.util.HashMap;
import java.io.BufferedReader; 
import java.io.FileReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.io.DataInputStream; 
import java.io.FileInputStream; 
import java.math.BigInteger;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.BitSet;
public class Prac{
    public static void merge(int arr[], int l, int m, int r){ 
        int n1 = m - l + 1; 
        int n2 = r - m; 
        int L[] = new int [n1]; 
        int R[] = new int [n2]; 
        for (int i=0; i<n1; ++i) 
            L[i] = arr[l + i]; 
        for (int j=0; j<n2; ++j) 
            R[j] = arr[m + 1+ j]; 
        int i = 0, j = 0; 
        int k = l; 
        while (i < n1 && j < n2) 
        { 
            if (L[i] <= R[j]) 
            { 
                arr[k] = L[i]; 
                //ind[k][0]=i;
               // ind[k][1]=dish[i];
               // ind[k][2]=L[i];
                i++; 
            } 
            else
            { 
                arr[k] = R[j]; 
               // ind[k][0]=j;
               // ind[k][1]=dish[j];
               // ind[k][2]=R[j];
                j++; 
            } 
            k++; 
        } 
        while (i < n1) 
        { 
            arr[k] = L[i];
           // ind[k][0]=i;
           // ind[k][1]=dish[i];
           // ind[k][2]=L[i];
            i++; 
            k++; 
        } 
        while (j < n2) 
        { 
            arr[k] = R[j];
          //  ind[k][0]=j;
          //  ind[k][1]=dish[j];
          //  ind[k][2]=R[i];
            j++; 
            k++; 
        } 
    } 
    public static void sort(int arr[], int l, int r) 
    { 
        if (l < r) 
        { 
            int m = (l+r)/2; 
            sort(arr, l, m); 
            sort(arr , m+1, r); 
            merge(arr, l, m, r); 
        } 
    }
    
    static class InputReader {
 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
 
		public InputReader(InputStream st) {
			this.stream = st;
		}
 
		public int read() {
			if (snumChars == -1)
	 			throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int ni() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nl() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nia(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = ni();
			}
			return a;
		}
 
		public String rs() {
			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 (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
 
	}
  

    static PrintWriter w = new PrintWriter(System.out);
    public static void main(String[] args) throws IOException {   
        InputReader sc=new InputReader(System.in);
        //DecimalFormat df=new DecimalFormat("0.00000000000000000000");
        //BigInteger b,max=BigInteger.ZERO;
        //Scanner sc=new Scanner(System.in);
        // HashMultiSet<Integer> multiSet = new HashMultiSet<>(new HashMap<>());      
        //findFact();
      
      
        int n=sc.ni();
        int arr[][]=new int[n+1][n+1];
        int a[]=new int[1001];
        boolean found=false;    
        int i=0,j=0;
        for(i=0;i<n*n;i++)
            a[sc.ni()]++;
        if(n%2==0){
            for(i=1;i<=1000;i++){
                if(a[i]%4!=0){
                    found=true;
                    break;
                }
            }
            if(found)
                w.println("NO");
            else{
                w.println("YES");
                i=1;
                j=1;
                for(int k=1;k<=1000;k++){
                    while(a[k]!=0){
                        arr[i][j]=k;
                        arr[i][n+1-j]=k;
                        arr[n+1-i][j]=k;
                        arr[n+1-i][n+1-j]=k;
                        i++;
                        if(i>n/2){
                            j++;
                            i=1;
                        }
                        a[k]-=4;
                    }
                }
                for(i=1;i<=n;i++){
                    for(j=1;j<=n;j++){
                        w.print(arr[i][j]+" ");
                    }
                    w.println();
                }
            }        
        }
        else{
            int one=0,two=0;
            for(i=1;i<=1000;i++){
                if(a[i]%2!=0){
                    arr[n/2+1][n/2+1]=i;
                    a[i]--;
                    one++;
                }
                if(a[i]%4==2){
                    two++;
                }
                if(one>1||two>(n/2)*2){
                    found=true;
                    break;
                }
            }
            if(found)
                w.println("NO");
            else{
                int count=n*n;
                w.println("YES");
                
                i=1;
                j=1;
                outer:
                for(int k=1;k<=1000;k++){
                    while(a[k]>=4){
                        arr[i][j]=k;
                        arr[i][n+1-j]=k;
                        arr[n+1-i][j]=k;
                        arr[n+1-i][n+1-j]=k;
                        i++;
                        if(i>n/2){
                            j++;
                            i=1;
                        }
                        a[k]-=4;
                        count-=4;
                        if(count==2*n-1)
                            break outer;
                    }
                }
                i=1;
                j=1;
                outer:
                for(int k=1;k<=1000;k++){
                    while(a[k]>=2){
                        arr[i][n/2+1]=k;
                        arr[n-i+1][n/2+1]=k;
                        i++;
                        a[k]-=2;
                        if(i==n/2+1)
                            break outer;
                    }
                }
                outer:
                for(int k=1;k<=1000;k++){
                    while(a[k]>=2){
                        arr[n/2+1][j]=k;
                        arr[n/2+1][n-j+1]=k;
                        j++;
                        a[k]-=2;
                        if(j==n/2+1)
                            break outer;
                     }
                }
                for(i=1;i<=n;i++){
                    for(j=1;j<=n;j++){
                        w.print(arr[i][j]+" ");
                    }
                    w.println();
                }
            }
        
        }    
        w.close();
    }
}