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 javafx.util.Pair;
import sun.reflect.generics.tree.Tree;

import java.io.*;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        FastScanner in = new FastScanner();
        Task solver = new Task();
        solver.solve(in);
        in.close();
    }

    static class Task {
        public void solve(FastScanner in) {
            int n = in.nextInt();
            int ans[][] = new int[n][n];
            int arr[] = new int[n * n];

            for (int i = 0; i < arr.length; i++)
                arr[i] = in.nextInt();

            TreeMap<Integer, Integer> have = new TreeMap<>();
            for (int i = 0; i < arr.length; i++) {
                if (have.containsKey(arr[i]))
                    have.put(arr[i], have.get(arr[i]) + 1);
                else
                    have.put(arr[i], 1);
            }


            Comparator<Pair<Integer, Integer>> cmp = new Comparator<Pair<Integer, Integer>>() {
                @Override
                public int compare(Pair<Integer, Integer> a, Pair<Integer, Integer> b) {
                    if (a.getValue().compareTo(b.getValue()) == 1)
                        return -1;
                    if (a.getValue().compareTo(b.getValue()) == -1)
                        return 1;
                    if (a.getKey().compareTo(b.getKey()) == -1)
                        return -1;
                    if (a.getKey().compareTo(b.getKey()) == 1)
                        return 1;
                    return 0;
                }
            };

            TreeSet < Pair<Integer, Integer> > q = new TreeSet<>(cmp);
            for (Map.Entry<Integer, Integer> elem : have.entrySet()) {
                q.add(new Pair<>(elem.getKey(), elem.getValue()));
            }

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (ans[i][j] != 0 || i == n - i - 1 || j == n - j - 1)
                        continue;
                    Pair<Integer, Integer> cur = q.first();
                    if (cur.getValue() < 4) {
                        System.out.print("NO");
                        return;
                    }
                    ans[i][j] = cur.getKey();
                    ans[n - i - 1][j] = cur.getKey();
                    ans[i][n - j - 1] = cur.getKey();
                    ans[n - i - 1][n - j - 1] = cur.getKey();
                    q.remove(q.first());
                    Pair<Integer, Integer> newcur = new Pair<>(cur.getKey(), cur.getValue() - 4);
                    q.add(newcur);
                }
            }

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (ans[i][j] != 0 || (i == n - i - 1 && j == n - j - 1))
                        continue;
                    Pair<Integer, Integer> cur = q.first();
                    if (i == n - i - 1) {
                        if (cur.getValue() < 2) {
                            System.out.print("NO");
                            return;
                        }
                        ans[i][j] = cur.getKey();
                        ans[i][n - j - 1] = cur.getKey();
                        q.remove(q.first());
                        Pair<Integer, Integer> newcur = new Pair<>(cur.getKey(), cur.getValue() - 2);
                        q.add(newcur);
                    } else {
                        if (cur.getValue() < 2) {
                            System.out.print("NO");
                            return;
                        }
                        ans[i][j] = cur.getKey();
                        ans[n - i - 1][j] = cur.getKey();
                        q.remove(q.first());
                        Pair<Integer, Integer> newcur = new Pair<>(cur.getKey(), cur.getValue() - 2);
                        q.add(newcur);
                    }
                }
            }

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (ans[i][j] != 0)
                        continue;
                    Pair<Integer, Integer> cur = q.first();

                    if (cur.getValue() < 1) {
                        System.out.print("NO");
                        return;
                    }
                    ans[i][j] = cur.getKey();
                }
            }

            System.out.println("YES");
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    System.out.print(ans[i][j] + " ");
                }
                System.out.print('\n');
            }
        }
    }




    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    public static class FastScanner {
        final private int BUFFER_SIZE = 4096;
        private InputStreamReader in;
        private char[] buffer;
        private int bufferPointer, bytesRead;

        public FastScanner() {
            in = new InputStreamReader(System.in, StandardCharsets.UTF_8);
            buffer = new char[BUFFER_SIZE];
            bufferPointer = 0;
            bytesRead = 0;
        }

        public FastScanner(String name) {
            try {
                in = new InputStreamReader(new FileInputStream(name), StandardCharsets.UTF_8);
            } catch (Exception e) {
                e.printStackTrace();
            }
            buffer = new char[BUFFER_SIZE];
            bufferPointer = 0;
            bytesRead = 0;
        }

        private void fillBuffer() {
            bufferPointer = 0;
            try {
                while ((bytesRead = in.read(buffer)) == 0) {}
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (bytesRead == -1)
                buffer[0] = 0;
        }

        private char next() {
            if (bufferPointer >= bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        public boolean hasNext() {
            if (bufferPointer >= bytesRead) {
                fillBuffer();
                return (bytesRead != -1);
            }
            return true;
        }

        public String nextLine() {
            try {
                StringBuilder now = new StringBuilder();
                char c;
                while (true) {
                    c = next();
                    if (c == 0 || c == '\n') {
                        break;
                    }
                    now.append(c);
                }
                return now.toString();
            } catch (Exception e) {
                e.printStackTrace();
                return "";
            }
        }

        private int convert(StringBuilder s) {
            try {
                return Integer.parseInt(s.toString());
            } catch (IndexOutOfBoundsException e) {
                e.printStackTrace();
                return 0;
            }
        }

        public ArrayList<Integer> nextLineAsIntegers() {
            try {
                String inp = nextLine();
                StringBuilder now = new StringBuilder();
                ArrayList<Integer> res = new ArrayList<>();

                for (int i = 0; i < inp.length(); i++) {
                    if (!(Character.isDigit(inp.charAt(i)) || inp.charAt(i) == '-')) {
                        if (now.length() > 0) {
                            res.add(convert(now));
                            now.delete(0, now.length());
                        }
                    } else {
                        now.append(inp.charAt(i));
                    }
                }
                if (now.length() > 0) {
                    res.add(convert(now));
                }
                return res;
            } catch (Exception e) {
                e.printStackTrace();
                return new ArrayList<>();
            }
        }

        public ArrayList<String> nextLineAsWords() {
            ArrayList<String> res = new ArrayList<>();

            try {
                StringBuffer now = new StringBuffer();
                String inp = nextLine();

                for (int i = 0; i < inp.length(); i++) {
                    if (!(Character.isLetter(inp.charAt(i)) || Character.getType(inp.charAt(i)) == Character.DASH_PUNCTUATION || inp.charAt(i) == '\'')) {
                        if (now.length() == 0) {
                            continue;
                        }
                        String cur = now.toString().toLowerCase();
                        res.add(cur);
                        now.delete(0, now.length());
                    } else {
                        now.append(inp.charAt(i));
                    }
                }
                if (now.length() > 0) {
                    String cur = now.toString().toLowerCase();
                    res.add(cur);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return res;
        }

        public String nextString() {
            while(true) {
                char c = next();
                if (!Character.isWhitespace(c)) {
                    bufferPointer--;
                    break;
                }
            }
            try {
                StringBuilder now = new StringBuilder();
                char c;
                while (true) {
                    c = next();
                    if (c == 0 || Character.isWhitespace(c)) {
                        break;
                    }
                    now.append(c);
                }
                return now.toString();
            } catch (Exception e) {
                e.printStackTrace();
                return "";
            }
        }

        public int nextInt() {
            try {
                int sign = 1, res = 0;
                char c;
                while (true) {
                    c = next();
                    if (!Character.isWhitespace(c)) {
                        break;
                    }
                }
                if (c == '-') {
                    sign = -1;
                    c = next();
                }
                while (Character.isDigit(c)) {
                    res = res * 10 + (int) (c - '0');
                    c = next();
                }
                bufferPointer--;
                if (sign == 1) {
                    return res;
                } else {
                    return -res;
                }
            } catch(Exception e) {
                e.printStackTrace();
                return 0;
            }
        }

        public long nextLong() {
            try {
                long sign = 1l, res = 0l;
                char c;
                while (true) {
                    c = next();
                    if (!Character.isWhitespace(c)) {
                        break;
                    }
                }
                if (c == '-') {
                    sign = -1l;
                    c = next();
                }
                while (Character.isDigit(c)) {
                    res = res * 10l + (long) (c - '0');
                    c = next();
                }
                bufferPointer--;
                if (sign == 1l) {
                    return res;
                } else {
                    return -res;
                }
            } catch(Exception e) {
                e.printStackTrace();
                return 0l;
            }
        }

        public double nextDouble() {
            double res = 0.0, div = 1.0;
            char c;
            while (true) {
                c = next();
                if (!Character.isWhitespace(c)) {
                    break;
                }
            }
            boolean sign = (c == '-');
            if (sign)
                c = next();

            do {
                res = res * 10.0 + (c - '0');
            }
            while ((c = next()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = next()) >= '0' && c <= '9') {
                    res += (c - '0') / (div *= 10.0);
                }
            }

            if (sign)
                return -res;
            return res;
        }

        public void close() {
            try {
                in.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}