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.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

@SuppressWarnings("Duplicates")
public class ProblemC {

    public static void main(String[] args) throws IOException{
        Reader sc = new Reader();
        PrintWriter pw = new PrintWriter(System.out);
        //Scanner sc = new Scanner(System.in);
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


        int size = sc.nextInt();
        int[][] matrix = new int[size][size];
        HashMap<Integer,Integer> numbers = new HashMap<>();
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < size; j++) {
                int aux = sc.nextInt();
                numbers.putIfAbsent(aux,0);
                numbers.computeIfPresent(aux,(integer, integer2) -> integer2+1);
            }
        }
        boolean can = true;
        boolean used = false;
        LinkedList<Integer> addMid = new LinkedList<>();
        int midRow = (size/2)*2;
        int mid = -1;
        for (Map.Entry<Integer, Integer> value : numbers.entrySet()) {
            if (size%2==1&&(value.getValue() % 4 == 1||value.getValue() % 4 == 3 )&& used){
                can=false;
            }
            if (size%2==1&&(value.getValue() % 4 == 1||value.getValue() % 4 == 3 )&& !used) {
                used = true;
                mid = value.getKey();
                value.setValue(value.getValue()-1);
            }
            if (size%2==1&&value.getValue() % 4 == 2 && midRow == 0){
                can=false;
            }
            if (size%2==1&&value.getValue() % 4 == 2 && midRow > 0) {
                midRow --;
                addMid.add(value.getKey());
                value.setValue(value.getValue()-2);
            }
            can = can && value.getValue()%4==0;
        }
        if (size%2==1&&can&&used){
            LinkedList<Integer> keys = new LinkedList<>(numbers.keySet());
            for (int i = midRow; i > 0; i-=2) {
                while (numbers.get(keys.getFirst())==0){
                    keys.removeFirst();
                }
                int val =keys.getFirst();
                numbers.put(keys.getFirst(),numbers.get(keys.getFirst())-4);
                addMid.add(val);
                addMid.add(val);
            }
            pw.println("YES");
            matrix[size/2][size/2]=mid;
            for (int i = 0; i < size / 2; i++) {
                for (int j = 0; j < size / 2; j++) {
                    while (numbers.get(keys.getFirst())==0){
                        keys.removeFirst();
                    }
                    int val =keys.getFirst();
                    numbers.put(keys.getFirst(),numbers.get(keys.getFirst())-4);
                    matrix[i][j] = val;
                    matrix[size-1-i][j]=val;
                    matrix[i][size-1-j]=val;
                    matrix[size-1-i][size-1-j]=val;
                }
            }
            for (int i = 0; i < size / 2; i++) {

                int val = addMid.removeFirst();
                int val2 = addMid.removeFirst();

                numbers.put(keys.getFirst(), numbers.get(keys.getFirst()) - 4);
                matrix[size / 2][i] = val;
                matrix[size / 2][size - i - 1] = val;
                matrix[i][size / 2] = val2;
                matrix[size - 1 - i][size / 2] = val2;
            }
            for (int i = 0; i < size; i++) {
                for (int j = 0; j < size; j++) {
                    pw.print(matrix[i][j]);
                    if (j==size-1)pw.println();
                    else pw.print(' ');
                }
            }

        }else if(size%2==0&&can&&!used){
            pw.println("YES");
            LinkedList<Integer> keys = new LinkedList<>(numbers.keySet());
            for (int i = 0; i < (size / 2); i++) {
                for (int j = 0; j < size / 2; j++) {
                    while (numbers.get(keys.getFirst())==0){
                        keys.removeFirst();
                    }
                    int val =keys.getFirst();
                    numbers.put(keys.getFirst(),numbers.get(keys.getFirst())-4);
                    matrix[i][j] = val;
                    matrix[size-1-i][j]=val;
                    matrix[i][size-1-j]=val;
                    matrix[size-1-i][size-1-j]=val;
                }
            }
            for (int i = 0; i < size; i++) {
                for (int j = 0; j < size; j++) {
                    pw.print(matrix[i][j]);
                    if (j==size-1)pw.println();
                    else pw.print(' ');
                }
            }
        }
        else pw.println("NO");

        pw.flush();
    }


    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
}