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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    int temp;
    cin >> temp;
    cout << "YES" << endl;
    cout << temp << endl;
  } else {
    int arr[n * n];
    unordered_map<int, int> m1;
    unordered_map<int, int>::iterator itr;
    for (int i = 0; i < n * n; i++) {
      cin >> arr[i];
      m1[arr[i]]++;
    }
    if (n % 2 == 0) {
      int flag = 0;
      for (itr = m1.begin(); itr != m1.end(); itr++) {
        if (itr->second % 4 != 0) {
          flag = 1;
          break;
        }
      }
      if (flag == 1)
        cout << "NO" << endl;
      else {
        cout << "YES" << endl;
        int matrix[n][n];
        memset(matrix, 0, sizeof(matrix));
        for (itr = m1.begin(); itr != m1.end();) {
          int temp = itr->first;
          int num = itr->second;
          int i = 0;
          int j = 0;
          while (j < n / 2) {
            while (i < n / 2) {
              matrix[i][j] = matrix[n - i - 1][n - j - 1] =
                  matrix[i][n - j - 1] = matrix[n - i - 1][j] = temp;
              num -= 4;
              i++;
              if (num == 0) {
                itr++;
                if (itr != m1.end()) {
                  temp = itr->first;
                  num = itr->second;
                }
              }
            }
            j++;
            i = 0;
          }
        }
        for (int k = 0; k < n; k++) {
          for (int p = 0; p < n; p++) cout << matrix[k][p] << " ";
          cout << endl;
        }
      }
    } else {
      int val = (n * n) - ((n - 1) * (n - 1));
      val = (n * n) - val;
      int val1 = (n * n) - 1;
      int count = 0;
      int temp;
      for (itr = m1.begin(); itr != m1.end(); itr++) {
        temp = itr->second;
        count += (temp / 4) * 4;
      }
      if (count >= val) {
        for (itr = m1.begin(); itr != m1.end(); itr++) {
          temp = (itr->second) % 4;
          count += (temp / 2) * 2;
        }
        if (count < val1) {
          cout << "NO" << endl;
        } else {
          cout << "YES" << endl;
          std::vector<int> v;
          std::vector<int>::iterator itr1;
          int matrix[n][n];
          memset(matrix, 0, sizeof(matrix));
          for (itr = m1.begin(); itr != m1.end();) {
            while (itr->second / 4 == 0) {
              itr++;
            }
            int temp = itr->first;
            int num = itr->second;
            int i = 0, j = 0;
            while (j < n / 2) {
              while (i < n / 2) {
                matrix[i][j] = matrix[n - i - 1][n - j - 1] =
                    matrix[i][n - j - 1] = matrix[n - i - 1][j] = temp;
                num -= 4;
                itr->second -= 4;
                i++;
                if (itr != m1.end() && itr->second / 4 == 0) {
                  itr++;
                  while (itr != m1.end() && itr->second / 4 == 0) {
                    itr++;
                  }
                  if (itr != m1.end()) {
                    temp = itr->first;
                    num = itr->second;
                  }
                }
              }
              j++;
              i = 0;
            }
            itr = m1.end();
          }
          int i = n / 2, j = 0;
          for (itr = m1.begin(); itr != m1.end(); itr++) {
            if (itr->second / 2 >= 1 && j < n / 2) {
              while (itr->second / 2 >= 1 && j < n / 2) {
                matrix[i][j] = matrix[i][n - j - 1] = itr->first;
                itr->second -= 2;
                j++;
              }
            }
            if (itr->second == 1) {
              matrix[n / 2][n / 2] = itr->first;
              itr->second--;
            }
          }
          j = n / 2;
          i = 0;
          for (itr = m1.begin(); itr != m1.end(); itr++) {
            if (itr->second / 2 >= 1 && i < n / 2) {
              while (itr->second / 2 >= 1 && i < n / 2) {
                matrix[i][j] = matrix[n - i - 1][j] = itr->first;
                itr->second -= 2;
                i++;
              }
            }
            if (itr->second == 1) {
              matrix[n / 2][n / 2] = itr->first;
              itr->second--;
            }
          }
          for (int k = 0; k < n; k++) {
            for (int p = 0; p < n; p++) cout << matrix[k][p] << " ";
            cout << endl;
          }
        }
      } else
        cout << "NO" << endl;
    }
  }
}