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;
long long sigma(long long n) { return (n * (n + 1) / 2); }
long long MOD(long long x) {
  if (x >= 0) return x;
  return (-x);
}
bool great(long long a, long long b) { return a > b; }
bool p_sm(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first == b.first) {
    return (a.second < b.second);
  }
  return (a.first < b.first);
}
long long max3(long long a, long long b, long long c) {
  return (max(a, max(b, c)));
}
long long max4(long long a, long long b, long long c, long long d) {
  return (max(max(a, b), max(c, d)));
}
long long min3(long long a, long long b, long long c) {
  return (min(a, min(b, c)));
}
long long min4(long long a, long long b, long long c, long long d) {
  return (min(min(a, b), min(c, d)));
}
vector<long long> factors(long long x) {
  vector<long long> v;
  for (int i = 1; i * i <= x; i++) {
    if (x % i == 0) {
      v.push_back(i);
      if (i != x / i) {
        v.push_back(x / i);
      }
    }
  }
  return v;
}
long long min_prime[1000006];
bool ispr[1000006];
void strt() {
  for (int i = 0; i < 1000005; i++) {
    min_prime[i] = -1;
  };
  for (int i = 0; i < 1000005; i++) {
    ispr[i] = true;
  };
  for (long long i = 2; i * i <= 1000005; i++) {
    if (!ispr[i]) {
      continue;
    }
    for (long long j = i * i; j <= 1000005; j += i) {
      if (min_prime[j] == -1) min_prime[j] = i;
      ispr[j] = false;
    }
  }
  for (long long i = 2; i < 1000006; i++) {
    if (ispr[i]) {
      min_prime[i] = i;
    }
  }
}
map<long long, long long> prime_fact(long long x) {
  map<long long, long long> mp;
  while (x != 1) {
    mp[min_prime[x]]++;
    x /= min_prime[x];
  }
  return mp;
}
long long power(long long a, long long b, long long m) {
  long long ans = 1;
  while (b > 0) {
    if (b % 2) {
      ans = (ans * a) % m;
    }
    a = (a * a) % m;
    b = b / 2;
  }
  return ans;
}
vector<vector<long long>> mat;
long long n;
map<long long, long long> mp;
bool fill(long long i, long long j, long long x) {
  if (mat[i][j] != 0) {
    return false;
  }
  mat[i][j] = mat[i][n - 1 - j] = mat[n - 1 - i][j] =
      mat[n - 1 - i][n - 1 - j] = x;
  if (i == n - 1 - i && j != n - 1 - j) {
    mp[x] -= 2;
  } else if (i != n - 1 - i && j == n - 1 - j) {
    mp[x] -= 2;
  } else if (i == n - 1 - i && j == n - 1 - i) {
    mp[x] -= 1;
  } else {
    mp[x] -= 4;
  }
  return true;
}
int main() {
  cin >> n;
  long long a[n * n];
  mat.resize(n);
  for (long long i = 0; i < n; i++) {
    mat[i].resize(n);
    for (long long j = 0; j < n; j++) {
      mat[i][j] = 0;
    }
  }
  for (int i = 0; i < n * n; i++) {
    cin >> a[i];
  };
  for (long long i = 0; i < n * n; i++) {
    mp[a[i]]++;
  }
  if (n % 2 == 0) {
    map<long long, long long>::iterator it;
    for (it = mp.begin(); it != mp.end(); ++it) {
      if ((it->second) % 4) {
        cout << "NO" << endl;
        exit(0);
        ;
      }
    }
    it = mp.begin();
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < n; j++) {
        bool cc = fill(i, j, it->first);
        if (it->second == 0 && cc) {
          ++it;
        }
      }
    }
  } else {
    vector<long long> tt;
    long long odd, ff;
    odd = ff = 0;
    map<long long, long long>::iterator it;
    long long ui = 0;
    for (it = mp.begin(); it != mp.end(); ++it) {
      if (((it->second) % 2) == 0 && (it->second) > 2) {
        ff = ff + ((it->second) / 4);
        tt.push_back(it->first);
      }
      if ((it->second) % 2) {
        ui = it->first;
        odd++;
      }
    }
    mp[ui]--;
    ff = ff + (mp[ui]) / 4;
    if (mp[ui] > 3) {
      tt.push_back(ui);
    }
    long long gg = ((n - 1) * (n - 1)) / 4;
    if ((ff < gg || odd > 1) && (mp.size() > 1)) {
      cout << "NO" << endl;
      exit(0);
      ;
    }
    it = mp.begin();
    if (mp.size() == 1) {
      cout << "YES" << endl;
      for (long long i = 0; i < n; i++) {
        for (long long j = 0; j < n; j++) {
          cout << it->first << " ";
        }
        cout << endl;
      }
      return 0;
    }
    mat[n / 2][n / 2] = ui;
    it = mp.begin();
    long long oo = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < n; j++) {
        if ((i == n / 2) || j == (n / 2)) {
          continue;
        }
        bool cc = fill(i, j, tt[oo]);
        if (mp[tt[oo]] < 4 && cc) {
          oo++;
        }
      }
    }
    map<long long, long long> mp1;
    for (it = mp.begin(); it != mp.end(); ++it) {
      if (it->second != 0) {
        mp1[it->first] = it->second;
      }
    }
    it = mp1.begin();
    for (long long i = 0; i < n; i++) {
      bool cc = fill(n / 2, i, it->first);
      if (cc) {
        mp1[it->first] -= 2;
        if (mp[it->first] == 0) {
          ++it;
        }
      }
    }
    for (long long i = 0; i < n; i++) {
      bool cc = fill(i, n / 2, it->first);
      if (cc) {
        mp1[it->first] -= 2;
        if (mp[it->first] == 0) {
          ++it;
        }
      }
    }
  }
  cout << "YES" << endl;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      cout << mat[i][j] << " ";
    }
    cout << endl;
  }
}