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 int maxn = 25;
const int maxm = 1010;
int n;
int num[maxn * maxn], buc[maxm];
int sq[maxn][maxn];
int n1, n2;
int num1;
queue<int> v;
void solve() {
  map<int, int> a;
  for (int i = 0; i < n * n; ++i) {
    int num;
    cin >> num;
    a[num]++;
  }
  vector<vector<int>> ans(n, vector<int>(n));
  if (n % 2 == 0) {
    bool flag = true;
    vector<int> help;
    for (auto item : a) {
      for (int i = 0; i < item.second; ++i) {
        help.push_back(item.first);
      }
      if (item.second % 4 != 0) {
        flag = false;
      }
    }
    if (flag) {
      cout << "YES" << endl;
      int ind = 0;
      for (int i = 0; i < n / 2; ++i) {
        for (int j = 0; j < n / 2; ++j) {
          int num = help[ind];
          ind += 4;
          ans[i][j] = num;
          ans[n - i - 1][j] = num;
          ans[n - i - 1][n - j - 1] = num;
          ans[i][n - j - 1] = num;
        }
      }
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
          cout << ans[i][j] << " ";
        }
        cout << endl;
      }
    } else {
      cout << "NO" << endl;
    }
  } else {
    vector<int> help;
    for (auto &item : a) {
      int num = item.first, cnt = item.second;
      for (int i = 0; i < cnt / 4; ++i) {
        for (int j = 0; j < 4; ++j) {
          help.push_back(num);
        }
      }
      cnt %= 4;
      item.second = cnt;
    }
    for (auto item : a) {
      for (int i = 0; i < item.second; ++i) {
        help.push_back(item.first);
      }
    }
    bool flag = true;
    int ind = 0;
    for (int i = 0; i < n / 2; ++i) {
      for (int j = 0; j < n / 2; ++j) {
        int num = help[ind];
        ind += 4;
        if (help[ind - 1] != num) {
          flag = false;
        }
        ans[i][j] = num;
        ans[n - i - 1][j] = num;
        ans[n - i - 1][n - j - 1] = num;
        ans[i][n - j - 1] = num;
      }
    }
    vector<int> tmp;
    for (int i = ind; i < help.size(); ++i) {
      tmp.push_back(help[i]);
    }
    map<int, int> b;
    for (auto item : tmp) {
      b[item]++;
    }
    int kk = 0;
    for (auto item : b) {
      if (item.second % 2 == 1) {
        kk++;
      }
    }
    help.clear();
    for (auto &item : b) {
      int num = item.first, cnt = item.second;
      for (int i = 0; i < cnt / 2; ++i) {
        for (int j = 0; j < 2; ++j) {
          help.push_back(num);
        }
      }
      cnt %= 2;
      item.second = cnt;
    }
    for (auto item : b) {
      for (int i = 0; i < item.second; ++i) {
        help.push_back(item.first);
      }
    }
    if (kk == 1 && flag) {
      int ind = 0;
      for (int i = 0; i < n / 2; ++i) {
        int num = help[ind];
        ind += 2;
        ans[n / 2][i] = num;
        ans[n / 2][n - i - 1] = num;
      }
      for (int i = 0; i < n / 2; ++i) {
        int num = help[ind];
        ind += 2;
        ans[i][n / 2] = num;
        ans[n - i - 1][n / 2] = num;
      }
      ans[n / 2][n / 2] = help[ind];
      cout << "YES" << endl;
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
          cout << ans[i][j] << " ";
        }
        cout << endl;
      }
    } else {
      cout << "NO" << endl;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  if (n & 1) {
    solve();
    return 0;
  }
  for (int i = 1; i <= n * n; ++i) {
    cin >> num[i];
    ++buc[num[i]];
  }
  for (int i = 0; i < maxm; ++i) {
    if (buc[i] % 4 == 1)
      --buc[i], ++n1, num1 = i;
    else if (buc[i] % 4 == 2)
      buc[i] -= 2, ++n2, v.push(i);
    else if (buc[i] % 4 == 3) {
      ++n1, ++n2;
      buc[i] -= 3, v.push(i), num1 = i;
    }
  }
  if (n & 1) {
    if (n1 > 1 || n2 > (n / 2) * 4) {
      cout << "NO";
      return 0;
    }
  } else {
    if (n1 + n2) {
      cout << "NO";
      return 0;
    }
  }
  if (n & 1) {
    for (int i = 0; i < maxm; ++i) {
      if (buc[i] == 0) continue;
      if (!(buc[i] % 4 == 0)) continue;
      if (v.size() == (n / 2) * 4) break;
      while (v.size() < (n / 2) * 2) {
        v.push(i);
        v.push(i);
        buc[i] -= 2;
        if (buc[i] == 0) break;
      }
    }
    sq[n / 2][n / 2] = num1;
    for (int i = 0; i < n / 2; ++i) {
      sq[i][n / 2] = v.front();
      v.pop();
      sq[n / 2][i] = v.front();
      v.pop();
    }
    int cnt = 0;
    for (int i = 0; i < maxm; ++i) {
      for (int j = 1; j <= buc[i] / 4; ++j) {
        sq[cnt / (n / 2)][cnt % (n / 2)] = i;
        ++cnt;
      }
    }
    for (int i = n / 2; i < n; ++i) {
      for (int j = 0; j < n / 2 + 1; ++j) {
        sq[i][j] = sq[n - 1 - i][j];
      }
    }
    for (int i = 0; i < n; ++i) {
      for (int j = n / 2; j < n; ++j) {
        sq[i][j] = sq[i][n - j - 1];
      }
    }
  } else {
    int cnt = 0;
    for (int i = 0; i < maxm; ++i) {
      for (int j = 1; j <= buc[i] / 4; ++j) {
        sq[cnt / (n / 2)][cnt % (n / 2)] = i;
        ++cnt;
      }
    }
    for (int i = n / 2; i < n; ++i) {
      for (int j = 0; j < n / 2; ++j) {
        sq[i][j] = sq[n - 1 - i][j];
      }
    }
    int q = 1;
    for (int i = 0; i < n; ++i) {
      for (int j = n / 2; j < n; ++j) {
        sq[i][j] = sq[i][n - j - 1];
      }
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cout << sq[i][j] << " ";
    }
    cout << endl;
  }
}