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>
#pragma GCC optimize("O3", "unroll-loops")
using namespace std;
template <class T, class U>
inline void checkmin(T &x, U y) {
  if (y < x) x = y;
}
template <class T, class U>
inline void checkmax(T &x, U y) {
  if (y > x) x = y;
}
template <class T, class U>
inline bool ifmin(T &x, U y) {
  if (y < x) return x = y, true;
  return false;
}
template <class T, class U>
inline bool ifmax(T &x, U y) {
  if (y > x) return x = y, true;
  return false;
}
template <class T>
inline void sort(T &a) {
  sort(a.begin(), a.end());
}
template <class T>
inline void rsort(T &a) {
  sort(a.rbegin(), a.rend());
}
template <class T>
inline void reverse(T &a) {
  reverse(a.begin(), a.end());
}
template <class T>
inline istream &operator>>(istream &stream, vector<T> &a) {
  for (auto &i : a) stream >> i;
  return stream;
}
void ex() {
  cout << "NO";
  exit(0);
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(15);
  srand(85453532);
  long long n;
  cin >> n;
  vector<long long> arr(n * n);
  cin >> arr;
  map<long long, long long> cnt;
  for (auto i : arr) cnt[i]++;
  set<pair<int, int>> st;
  vector<vector<long long>> ans(n, vector<long long>(n));
  for (auto i : cnt) st.insert({i.second, i.first});
  for (int i = 0; i < n / 2; ++i)
    for (int j = 0; j < n / 2; ++j) {
      pair<int, int> b = *(--st.end());
      st.erase(b);
      if (b.first < 4) ex();
      ans[i][j] = ans[n - i - 1][j] = ans[i][n - 1 - j] =
          ans[n - 1 - i][n - 1 - j] = b.second;
      b.first -= 4;
      if (b.first) st.insert(b);
    }
  if (n & 1) {
    for (int i = 0; i < n / 2; ++i) {
      pair<int, int> b = *(--st.end());
      st.erase(b);
      if (b.first < 2) ex();
      ans[i][n >> 1] = ans[n - i - 1][n >> 1] = b.second;
      b.first -= 2;
      if (b.first) st.insert(b);
    }
    for (int i = 0; i < n / 2; ++i) {
      pair<int, int> b = *(--st.end());
      st.erase(b);
      if (b.first < 2) ex();
      ans[n >> 1][i] = ans[n >> 1][n - i - 1] = b.second;
      b.first -= 2;
      if (b.first) st.insert(b);
    }
    ans[n >> 1][n >> 1] = st.begin()->second;
  }
  cout << "YES\n";
  for (auto i : ans) {
    for (auto j : i) cout << j << ' ';
    cout << '\n';
  }
  return 0;
}