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;
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vu = vector<ull>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using muu = map<ull, ull>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using puu = pair<ull, ull>;
using vii = vector<pii>;
using vll = vector<pll>;
using vuu = vector<puu>;
void pmain();
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  pmain();
  return 0;
}
template <class T>
T lcm(T a, T b) {
  return a / __gcd(a, b) * b;
}
template <class B, class E>
B binpow(B base, E exp) {
  if (exp == 0) return (B)1;
  if (exp % 2 == 0) {
    B root = binpow<B, E>(base, exp / 2);
    return root * root;
  }
  return binpow<B, E>(base, exp - 1) * base;
}
template <class M, M mod, class B, class E>
B binpowmod(B base, E exp) {
  if (exp == 0) return (B)1;
  if (exp % 2 == 0) {
    B root = binpowmod<M, mod, B, E>(base, exp / 2);
    return (root * root) % mod;
  }
  return (binpowmod<M, mod, B, E>(base, exp - 1) * base) % mod;
}
template <class N>
N arithsum(N a, N d, N n) {
  return (2 * a + (n - 1) * d) * n / 2;
}
template <class T>
void factors(T n, vector<T> &m) {
  T k = n;
  while (k % 2 == 0) {
    m.push_back(2);
    k /= 2;
  }
  for (T i = 3; i * i <= n; i += 2) {
    if (k % i == 0) {
      m.push_back(i);
      k /= i;
      --i;
    }
  }
  if (k != 0) {
    m.push_back(k);
  }
}
template <class T>
void factors(T n, map<T, T> &m) {
  T k = n;
  while (k % 2 == 0) {
    ++m[2];
    k /= 2;
  }
  for (T i = 3; i * i <= n; i += 2) {
    if (k % i == 0) {
      ++m[i];
      k /= i;
      --i;
    }
  }
  if (k != 0) {
    ++m[k];
  }
}
template <class T>
T count_divisors(const map<T, T> &v) {
  T a = 1;
  for (const auto &i : v) {
    a *= 1 + i.second;
  }
  return a;
}
ull n;
ull a[405];
ull m[20][20];
void pmain() {
  while (cin >> n) {
    ull diag = (n - 1) / 2;
    ull x = 0, y = 0;
    muu nums;
    stack<ull> nums1, nums2, nums4;
    for (ull i = 0; i < n * n; ++i) {
      ull u;
      cin >> u;
      ++nums[u];
    }
    if (n == 1) {
      m[0][0] = nums.begin()->first;
    } else if (n % 2 == 0) {
      nums1 = stack<ull>();
      nums2 = stack<ull>();
      nums4 = stack<ull>();
      for (auto p : nums) {
        if (p.second % 4 != 0) goto fail;
        for (ull i = 0; i < p.second; i += 4) {
          nums2.push(p.first);
        }
      }
      x = y = 0;
      while (true) {
        m[x][y] = m[n - x - 1][y] = m[x][n - y - 1] = m[n - x - 1][n - y - 1] =
            nums2.top();
        nums2.pop();
        if ((++x) * 2 == n) {
          x = 0;
          if ((++y) * 2 == n) {
            break;
          }
        }
      }
    } else {
      nums1 = stack<ull>();
      nums2 = stack<ull>();
      nums4 = stack<ull>();
      for (auto p : nums) {
        ull r = p.second;
        while (r >= 4) {
          nums4.push(p.first);
          r -= 4;
        }
        while (r >= 2) {
          nums2.push(p.first);
          r -= 2;
        }
        if (r != 0) {
          nums1.push(p.first);
          r -= 1;
        }
      }
      x = y = 0;
      while (true) {
        if (nums4.empty()) goto fail;
        m[x][y] = m[n - x - 1][y] = m[x][n - y - 1] = m[n - x - 1][n - y - 1] =
            nums4.top();
        nums4.pop();
        if (++x >= diag) {
          x = 0;
          if (++y >= diag) {
            break;
          }
        }
      }
      while (!nums4.empty()) {
        nums2.push(nums4.top());
        nums2.push(nums4.top());
        nums4.pop();
      }
      for (ull i = 0; i < diag; ++i) {
        if (nums2.empty()) goto fail;
        m[i][diag] = m[n - i - 1][diag] = nums2.top();
        nums2.pop();
        if (nums2.empty()) goto fail;
        m[diag][i] = m[diag][n - i - 1] = nums2.top();
        nums2.pop();
      }
      if (!nums2.empty()) goto fail;
      if (nums1.size() != 1) goto fail;
      m[diag][diag] = nums1.top();
    }
  output:
    cout << "YES" << endl;
    for (ull i = 0; i < n; ++i) {
      for (ull j = 0; j < n; ++j) {
        cout << m[i][j] << " ";
      }
      cout << endl;
    }
    continue;
  fail:
    cout << "NO" << endl;
  }
}