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>
const double PI = acos(-1);
const double EPS = 1e-12;
const int MOD = 1e9 + 7;
const int INF = 1 << 30;
using namespace std;
int main() {
  int in;
  int fl = 0, t = 0, tt;
  cin >> in;
  int data[1005];
  int count[1005];
  int temp[1005];
  int res[25][25];
  vector<int> v;
  for (int i = 1; i <= 1000; i += 1) {
    count[i] = 0;
  }
  for (int i = 1; i <= 20; i += 1) {
    for (int j = 1; j <= 20; j += 1) {
      res[i][j] = -1;
    }
  }
  for (int i = 1; i <= in * in; i += 1) {
    cin >> data[i];
    count[data[i]]++;
  }
  if (in != 1) {
    sort(data + 1, data + in * in + 1);
    if (in % 2 == 1) {
      for (int i = 1; i <= 1000; i += 1) {
        if (fl == 0 && (count[i] % 2 == 1 || count[i] % 2 == 3)) {
          fl = 1;
          tt = i;
        } else if (fl == 1 && (count[i] % 2 == 1 || count[i] % 2 == 3)) {
          fl = 2;
          break;
        }
      }
    } else {
      for (int i = 1; i <= 1000; i += 1) {
        if (count[i] % 4 != 0) {
          fl = 2;
          break;
        }
      }
    }
    if (fl == 2)
      cout << "NO" << endl;
    else {
      t = 0;
      for (int i = 1; i <= 1000; i += 1) {
        temp[i] = count[i] / 4;
      }
      if (in % 2 == 1) {
        res[(in) / 2][(in) / 2] = tt;
        for (int i = 1; i <= 1000; i += 1) {
          if (count[i] % 4 == 2) {
            v.push_back(i);
          } else if (count[i] % 4 == 3 && i == tt) {
            v.push_back(i);
          }
        }
        if (v.size() < in - 1 && (in - 1 - v.size()) % 2 != 0) {
          cout << "NO" << endl;
          fl = 2;
        } else if (v.size() > in - 1) {
          cout << "NO" << endl;
          fl = 2;
        } else {
          int sz = 2 * v.size();
          int x = 1;
          while (sz < 2 * in - 2) {
            if (temp[x] > 0) {
              v.push_back(x);
              v.push_back(x);
              temp[x]--;
              if (temp[x] == 0) x++;
              sz += 4;
            } else
              x++;
          }
          int ss = v.size();
          int ts = 0;
          for (int i = 0; i <= in / 2 - 1; i += 1) {
            res[i][in / 2] = v[ts];
            res[in - i - 1][in / 2] = v[ts];
            ts++;
          }
          for (int i = 0; i <= in / 2 - 1; i += 1) {
            res[in / 2][i] = v[ts];
            res[in / 2][in - i - 1] = v[ts];
            ts++;
          }
          for (int i = 1; i <= 1000; i += 1) {
            while (temp[i] > 0) {
              res[(t / in)][t % in] = i;
              res[in - (t / in) - 1][t % in] = i;
              res[(t / in)][in - (t % in) - 1] = i;
              res[in - (t / in) - 1][in - (t % in) - 1] = i;
              while (res[(t / in)][t % in] != -1) {
                t++;
              }
              temp[i]--;
            }
          }
        }
      } else {
        for (int i = 1; i <= 1000; i += 1) {
          while (temp[i] > 0) {
            res[(t / in)][t % in] = i;
            res[in - (t / in) - 1][t % in] = i;
            res[(t / in)][in - (t % in) - 1] = i;
            res[in - (t / in) - 1][in - (t % in) - 1] = i;
            while (res[(t / in)][t % in] != -1) {
              t++;
            }
            temp[i]--;
          }
        }
      }
      if (fl != 2) {
        cout << "YES" << endl;
        for (int i = 0; i <= in - 1; i += 1) {
          for (int j = 0; j <= in - 1; j += 1) {
            cout << res[i][j];
            if (j != in - 1)
              cout << " ";
            else
              cout << endl;
          }
        }
      }
    }
  } else {
    cout << "YES" << endl << data[1] << endl;
  }
  return 0;
}