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.math.*;
import java.util.*;

/**
 *
 * @author Saju
 *
 */

public class Main {

    private static int dx[] = { 1, 0, -1, 0 };
    private static int dy[] = { 0, -1, 0, 1 };
    
    private static int dx1[] = { 1, 1, 0, -1, -1, -1, 0, 1 };
    private static int dy1[] = { 0, -1, -1, -1, 0, 1, 1, 1 };

    private static final long INF = (long) Math.pow(10, 16);
    private static final int INT_INF = Integer.MAX_VALUE;
    private static final long NEG_INF = Long.MIN_VALUE;
    private static final int NEG_INT_INF = Integer.MIN_VALUE;
    private static final double EPSILON = 1e-10;

    private static final long MAX = (long) 1e12;
    
    private static final long MOD = 1000000007;

    private static final int MAXN = 200001;
    private static final int MAXA = 100007;
    private static final int MAXLOG = 22;
    private static final double PI = Math.acos(-1);
    
	public static void main(String[] args) throws IOException {

		InputReader in = new InputReader(System.in);
//		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

//         InputReader in = new InputReader(new FileInputStream("src/test.in"));
//         PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("src/test.out")));

		
		
/*



*/		
		
		int n = in.nextInt();
		
		int arr[] = in.nextIntArr(n * n);
		
		
		int c[] = new int[10001];
		for(int i = 0; i < arr.length; i++) {
			c[arr[i]]++;
		}
		
		if(n % 2 == 0) {
			boolean ok = true;
			for(int i = 0; i < c.length; i++) {
				if(c[i] % 4 != 0) {
					ok = false;
					break;
				}
			}
			if(!ok) {
				out.println("NO");
			}
			else {
				out.println("YES");
				int[][] mat = new int[n][n];
				
				for(int i = 0; i < n / 2; i++) {
					for(int j = 0; j < n / 2; j++) {
						mat[i][j] = find(c);
						mat[n - i - 1][j] = mat[i][j];
						mat[i][n - j - 1] = mat[i][j];
						mat[n - i - 1][n - j - 1] = mat[i][j];
					}
				}
				for(int i = 0; i < n; i++) {
					for(int j = 0; j < n; j++) {
						out.print(mat[i][j] + " ");
					}
					out.println();
				}
			}
			
			
		}
		else {
			int[][] mat = new int[n][n];
			boolean ok = true;
			for(int i = 0; i < n / 2; i++) {
				for(int j = 0; j < n / 2; j++) {
					mat[i][j] = find1(c, false);
					if(mat[i][j] == 0) {
						ok = false;
						break;
					}
					mat[n - i - 1][j] = mat[i][j];
					mat[i][n - j - 1] = mat[i][j];
					mat[n - i - 1][n - j - 1] = mat[i][j];
				}
				if(!ok) {
					break;
				}
			}
			
//			for(int i = 0; i < n; i++) {
//				System.out.println(Arrays.toString(mat[i]));
//			}
			
			if(!ok) {
				out.println("NO");
				out.flush();
				return;
			}
			
			
			for(int i = 0; i < n / 2; i++) {
				int j = n / 2;
				mat[j][i] = find1(c, true);
				if(mat[j][i] == 0) {
					ok = false;
					break;
				}
				mat[j][n - i - 1] = mat[j][i];
				mat[i][j] = find1(c, true);
				if(mat[i][j] == 0) {
					ok = false;
					break;
				}
				mat[n - i - 1][j] = mat[i][j];
			}
			
			if(!ok) {
				out.println("NO");
				out.flush();
				return;
			}
			
			
			mat[n/2][n/2] = find2(c);
			
			out.println("YES");
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < n; j++) {
					out.print(mat[i][j] + " ");
				}
				out.println();
			}
		}
		
		
		in.close();
		out.flush();
		out.close();
		System.exit(0);
	}
	

	private static int find2(int[] c) {
		for(int i = 1; i <= 1000; i++) {
			if(c[i] > 0) {
				return i;
			}
		}
		return 0;
	}


	private static int find1(int[] c, boolean b) {
		for(int i = 1; i <= 1000; i++) {
			if(!b && c[i] >= 4) {
				c[i]-= 4;
				return i;
			}
			if(b && c[i] >= 2) {
				c[i] -= 2;
				return i;
			}
			if(c[i] != 0 && c[i] % 4 == 0 && !b) {
				c[i]-= 4;
				return i;
			}
			if(c[i] != 0 && c[i] % 2 == 0 && b) {
				c[i]-=2;
				return i;
			}
		}
		return 0;
	}


	private static int find(int[] c) {
		for(int i = 1; i <= 1000; i++) {
			if(c[i] != 0 && c[i] % 4 == 0) {
				c[i]-= 4;
				return i;
			}
		}
		return 0;
	}


	/*
	 * return the number of elements in list that are less than or equal to the val
	 */
	private static long upperBound(List<Long> list, long val) {
		int start = 0;
		int len = list.size();
		int end = len - 1;
		int mid = 0;

		while (true) {
			if (start > end) {
				break;
			}
			mid = (start + end) >> 1;
			long v = list.get(mid);
			if (v == val) {
				start = mid;
				while(start < end) {
					mid = (start + end) >> 1;
					if(list.get(mid) == val) {
						if(mid + 1 < len && list.get(mid + 1) == val) {
							start = mid + 1;
						}
						else {
							return mid + 1;
						}
					}
					else {
						end = mid - 1;
					}
				}
				return start + 1;
			}
			if (v > val) {
				end = mid - 1;
			} else {
				start = mid + 1;
			}
		}
		if (list.get(mid) < val) {
			return mid + 1;
		}
		return mid;
	}


	private static boolean isPalindrome(String str) {
		StringBuilder sb = new StringBuilder();
		sb.append(str);
		String str1 = sb.reverse().toString();
		return str.equals(str1);
	}

	private static String getBinaryStr(long n, int j) {
		String str = Long.toBinaryString(n);
		int k = str.length();
		for (int i = 1; i <= j - k; i++) {
			str = "0" + str;
		}

		return str;
	}
	
	private static long modInverse(long r) {
		return bigMod(r, MOD - 2, MOD);
	}
	
	private static long bigMod(long n, long k, long m) {

        long ans = 1;
        while (k > 0) {
            if ((k & 1) == 1) {
                ans = (ans * n) % m;
            }
            n = (n * n) % m;
            k >>= 1;
        }
        return ans;
    }
    
	private static long ceil(long n, long x) {
		long div = n / x;
        if(div * x != n) {
            div++;
        }
        return div;
	}
	
    private static int ceil(int n, int x) {
        int div = n / x;
        if(div * x != n) {
            div++;
        }
        return div;
    }

    
    private static int abs(int x) {
        if (x < 0) {
            return -x;
        }
        return x;
    }
    
    private static double abs(double x) {
        if (x < 0) {
            return -x;
        }
        return x;
    }

    private static long abs(long x) {
        if(x < 0) {
            return -x;
        }
        return x;
    }
    
    private static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    private static int lcm(int a, int b) {
        return (a * b) / gcd(a, b);
    }

    private static int gcd(int a, int b) {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }
    
    private static long gcd(long a, long b) {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    private static int log(long x, int base) {
        return (int) (Math.log(x) / Math.log(base));
    }

    private static int log(long x, long base) {
        return (int) (Math.log(x) / Math.log(base));
    }
    
    private static long min(long a, long b) {
        if (a < b) {
            return a;
        }
        return b;
    }

    private static int min(int a, int b) {
        if (a < b) {
            return a;
        }
        return b;
    }

    private static long max(long a, long b) {
        if (a < b) {
            return b;
        }
        return a;
    }

    private static int max(int a, int b) {
        if (a < b) {
            return b;
        }
        return a;
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());

                }
            } catch (IOException e) {
                return null;
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            String line = null;
            try {
                tokenizer = null;
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

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

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

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

        public boolean hasNext() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (Exception e) {
                return false;
            }
            return true;
        }
        
        public int[] nextIntArr(int n) {
        	int arr[] = new int[n];
    		for(int i = 0; i < n; i++) {
    			arr[i] = nextInt();
    		}
    		return arr;
        }
        
        public long[] nextLongArr(int n) {
        	long arr[] = new long[n];
    		for(int i = 0; i < n; i++) {
    			arr[i] = nextLong();
    		}
    		return arr;
        }
        
        public int[] nextIntArr1(int n) {
        	int arr[] = new int[n + 1];
    		for(int i = 1; i <= n; i++) {
    			arr[i] = nextInt();
    		}
    		return arr;
        }
        
        public long[] nextLongArr1(int n) {
        	long arr[] = new long[n + 1];
    		for(int i = 1; i <= n; i++) {
    			arr[i] = nextLong();
    		}
    		return arr;
        }
       
        public void close() {
        	try {
        		if(reader != null) {
        			reader.close();
        		}
        	}
        	catch(Exception e) {
        		
        	}
        	
        	
        }
    }

}