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;
typedef long long int ll;
typedef unsigned long long int ull;
inline void smax(int &x, int y) { x = max(x, y); }
inline void smin(int &x, int y) { x = min(x, y); }
ll gcd(ll a, ll b) { return ((b == 0) ? a : gcd(b, a % b)); }
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> v(n * n);
  for (__typeof(n * n) i = (0) - ((0) > (n * n));
       i != (n * n) - ((0) > (n * n)); i += 1 - 2 * ((0) > (n * n)))
    cin >> v[i];
  if (n % 2 == 0) {
    vector<int> cnt(1001);
    for (__typeof(n * n) i = (0) - ((0) > (n * n));
         i != (n * n) - ((0) > (n * n)); i += 1 - 2 * ((0) > (n * n))) {
      cnt[v[i]]++;
    }
    int f = 0;
    for (__typeof(cnt.size()) i = (0) - ((0) > (cnt.size()));
         i != (cnt.size()) - ((0) > (cnt.size()));
         i += 1 - 2 * ((0) > (cnt.size()))) {
      if (cnt[i] % 4 != 0) f = 1;
    }
    if (f == 1)
      cout << "NO";
    else {
      cout << "YES" << endl;
      vector<vector<int> > mat(n, vector<int>(n));
      int pt = 0;
      for (__typeof(n / 2) i = (0) - ((0) > (n / 2));
           i != (n / 2) - ((0) > (n / 2)); i += 1 - 2 * ((0) > (n / 2))) {
        for (__typeof(n / 2) j = (0) - ((0) > (n / 2));
             j != (n / 2) - ((0) > (n / 2)); j += 1 - 2 * ((0) > (n / 2))) {
          while (cnt[pt] == 0) pt++;
          mat[i][j] = pt;
          mat[i][n - j - 1] = pt;
          mat[n - i - 1][j] = pt;
          mat[n - i - 1][n - j - 1] = pt;
          cnt[pt] -= 4;
        }
      }
      for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
           i += 1 - 2 * ((0) > (n))) {
        for (__typeof(n) j = (0) - ((0) > (n)); j != (n) - ((0) > (n));
             j += 1 - 2 * ((0) > (n)))
          cout << mat[i][j] << " ";
        cout << endl;
      }
    }
  } else {
    vector<int> cnt(1001);
    for (__typeof(n * n) i = (0) - ((0) > (n * n));
         i != (n * n) - ((0) > (n * n)); i += 1 - 2 * ((0) > (n * n))) {
      cnt[v[i]]++;
    }
    int cnt2 = 0, cnt4 = 0, cnt1 = 0;
    for (__typeof(cnt.size()) i = (0) - ((0) > (cnt.size()));
         i != (cnt.size()) - ((0) > (cnt.size()));
         i += 1 - 2 * ((0) > (cnt.size()))) {
      cnt4 += cnt[i] / 4;
      cnt2 += cnt[i] / 2;
      cnt1 += cnt[i] % 2;
    }
    if (cnt1 != 1) {
      cout << "NO";
      exit(0);
    }
    if (cnt4 < (n / 2) * (n / 2)) {
      cout << "NO";
      exit(0);
    }
    int pt = 0;
    cout << "YES" << endl;
    vector<vector<int> > mat(n, vector<int>(n));
    for (__typeof(n / 2) i = (0) - ((0) > (n / 2));
         i != (n / 2) - ((0) > (n / 2)); i += 1 - 2 * ((0) > (n / 2))) {
      for (__typeof(n / 2) j = (0) - ((0) > (n / 2));
           j != (n / 2) - ((0) > (n / 2)); j += 1 - 2 * ((0) > (n / 2))) {
        while (cnt[pt] / 4 <= 0) pt++;
        mat[i][j] = pt;
        mat[i][n - j - 1] = pt;
        mat[n - i - 1][j] = pt;
        mat[n - i - 1][n - j - 1] = pt;
        cnt[pt] -= 4;
      }
    }
    pt = 0;
    for (int i = 0; i < n / 2; i++) {
      while (cnt[pt] / 2 <= 0) pt++;
      mat[i][n / 2] = pt;
      mat[n - i - 1][n / 2] = pt;
      cnt[pt] -= 2;
    }
    for (int i = 0; i < n / 2; i++) {
      while (cnt[pt] / 2 <= 0) pt++;
      mat[n / 2][i] = pt;
      mat[n / 2][n - i - 1] = pt;
      cnt[pt] -= 2;
    }
    int val = 0;
    for (__typeof(1001) i = (0) - ((0) > (1001)); i != (1001) - ((0) > (1001));
         i += 1 - 2 * ((0) > (1001)))
      if (cnt[i] > 0) {
        val = i;
        break;
      }
    mat[n / 2][n / 2] = val;
    for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
         i += 1 - 2 * ((0) > (n))) {
      for (__typeof(n) j = (0) - ((0) > (n)); j != (n) - ((0) > (n));
           j += 1 - 2 * ((0) > (n)))
        cout << mat[i][j] << " ";
      cout << endl;
    }
  }
}