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;
int grid[20][20];
map<int, int> counts;
int N = 0;
auto iter = counts.begin();
int odd = 0;
bool check() {
  if (N % 2 == 0) {
    for (auto a : counts)
      if (a.second < 4 || a.second % 2 == 1) return false;
    return true;
  } else {
    int num_odd = 0;
    for (auto a : counts) {
      if (a.second % 2 == 1) {
        num_odd++;
        odd = a.first;
      }
    }
    if (num_odd > 1)
      return false;
    else
      return true;
  }
}
bool can_place() {
  for (auto a : counts)
    if (a.second >= 4) return true;
  return false;
}
bool check_grid() {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      if (grid[i][j] == 0) return false;
  return true;
}
void fill_grid(int r, int c) {
  if (!can_place()) return;
  if (iter == counts.end()) iter = counts.begin();
  if (N - c - 1 <= c) return;
  if (iter->second == 0) iter = counts.erase(iter);
  if (N - r - 1 <= r)
    fill_grid(0, c + 1);
  else if (iter->second >= 4) {
    int val = iter->first;
    iter->second -= 4;
    grid[r][c] = val;
    grid[r][N - c - 1] = val;
    grid[N - r - 1][c] = val;
    grid[N - r - 1][N - c - 1] = val;
    fill_grid(r + 1, c);
  } else {
    iter++;
    fill_grid(r, c);
  }
}
int count_cands() {
  int num = 0;
  for (auto a : counts)
    if (a.second >= 2) num++;
  return num;
}
void fill_cross(bool c) {
  int count = count_cands();
  int i = 0, mid = N / 2;
  while (i != mid) {
    if (count == 0) return;
    if (iter == counts.end()) iter = counts.begin();
    if (iter->second < 2) {
      iter++;
      continue;
    }
    iter->second -= 2;
    if (iter->second < 2) count--;
    int val = iter->first;
    if (!c) {
      grid[i][mid] = val;
      grid[N - i - 1][mid] = val;
    } else {
      grid[mid][i] = val;
      grid[mid][N - i - 1] = val;
    }
    if (iter->second == 0) iter = counts.erase(iter);
    i++;
  }
}
void fill_cross() {
  fill_cross(true);
  fill_cross(false);
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) grid[i][j] = 0;
  int test = 0;
  for (int i = 0; i < N * N; i++) {
    cin >> test;
    counts[test]++;
  }
  iter = counts.begin();
  if (N == 1) {
    cout << "YES" << endl;
    cout << iter->first << endl;
  } else {
    if (!check())
      cout << "NO" << endl;
    else {
      fill_grid(0, 0);
      if (N % 2 == 1) fill_cross();
      if (N % 2 == 1) grid[N / 2][N / 2] = odd;
      if (!check_grid())
        cout << "NO" << endl;
      else {
        cout << "YES" << endl;
        for (int i = 0; i < N; i++) {
          for (int j = 0; j < N; j++) {
            cout << grid[i][j] << " ";
          }
          cout << endl;
        }
      }
    }
  }
  return 0;
}