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;
const long long MAXN = 2e6 + 10, inf = 1e18, mod = 1e9 + 7;
struct pair_hash {
  template <class T1, class T2>
  std::size_t operator()(const std::pair<T1, T2> &p) const {
    auto h1 = std::hash<T1>{}(p.first);
    auto h2 = std::hash<T2>{}(p.second);
    return h1 ^ h2;
  }
};
long long pw(long long te, long long tee) {
  if (tee == 0) return 1;
  long long res = pw(te, tee / 2);
  return (tee % 2 ? te * res * res : res * res);
}
long long n, a[1010], ans[30][30];
map<long long, long long> mp2, mp4;
void Read_input() {
  cin >> n;
  long long tmp;
  for (long long i = 1; i <= n * n; i++) cin >> tmp, a[tmp]++;
}
void Solve() {
  long long cnt = 0, t = 0, k = 0, p = 0;
  for (long long i = 1; i < 1010; i++) {
    cnt += a[i] % 4;
    if (a[i] % 2) t = i;
    if (a[i] % 2) k++;
    if (a[i] % 4 == 2) p++;
    if (a[i] > 0 and a[i] % 4 == 0) {
      mp4[i] = a[i];
    }
    if (a[i] > 0 and a[i] % 4 == 2) {
      mp2[i] = 2;
      if (a[i] > 2) mp4[i] = a[i] - 2;
    }
  }
  if (n % 2) {
    ans[(n + 1) / 2][(n + 1) / 2] = t;
    a[t]--;
    k--;
    if (a[t] > 0 and a[t] % 4 == 0) {
      mp4[t] = a[t];
    }
    if (a[t] > 0 and a[t] % 4 == 2) {
      mp2[t] = 2;
      if (a[t] > 2) mp4[t] = a[t] - 2;
      p++;
    }
  }
  if (k > 1 or (cnt != 0 and n % 2 == 0) or (p > n - 1)) {
    cout << "NO";
    exit(0);
  }
  t = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (ans[i][j] != 0) continue;
      bool flag = false, fflag = false;
      if (n % 2 and (i == (n + 1) / 2 or j == (n + 1) / 2)) {
        flag = true;
        if (!mp2.empty()) {
          t = mp2.begin()->first;
        } else {
          t = mp4.begin()->first;
          fflag = true;
        }
      } else {
        if (mp4.empty()) {
          cout << "NO";
          exit(0);
        }
        t = mp4.begin()->first;
      }
      ans[i][j] = t;
      ans[i][n - j + 1] = t;
      ans[n - i + 1][j] = t;
      ans[n - i + 1][n - j + 1] = t;
      if (flag and !fflag) {
        mp2[t] -= 2;
        if (mp2[t] == 0) mp2.erase(t);
      } else {
        if (fflag) {
          mp4[t] -= 2;
          mp2[t] = 2;
          mp4[t] -= 2;
        } else
          mp4[t] -= 4;
        if (mp4[t] == 0) mp4.erase(t);
      }
    }
  }
  cout << "YES" << endl;
  for (long long i = 1; i <= n; i++) {
    cout << ans[i][1];
    for (long long j = 2; j <= n; j++) cout << " " << ans[i][j];
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  Read_input(), Solve();
  return 0;
}