Problem: Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.

Input

The only line contains odd integer n (1 ≤ n ≤ 49).

Output

Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.

Examples

Input

1


Output

1


Input

3


Output

2 1 4
3 5 7
6 9 8

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, ji, ou, heng, shu, x;
  bool f[55][55];
  int a[55][55];
  memset(f, false, sizeof(f));
  cin >> n;
  f[n / 2 + 1][n / 2 + 1] = true;
  k = n;
  while (k > 1) {
    if (k % 4 == 3)
      heng = shu = (k - 1) / 2;
    else {
      heng = (k - 1) / 2 - 1;
      shu = (k - 1) / 2 + 1;
    }
    x = (n - k) / 2 + 1;
    for (i = n / 2 + 1 - shu / 2; i <= n / 2 + 1 + shu / 2; i++) f[i][x] = true;
    for (j = n / 2 + 1 - heng / 2; j <= n / 2 + 1 + heng / 2; j++)
      f[x][j] = true;
    x = n + 1 - x;
    for (i = n / 2 + 1 - shu / 2; i <= n / 2 + 1 + shu / 2; i++) f[i][x] = true;
    for (j = n / 2 + 1 - heng / 2; j <= n / 2 + 1 + heng / 2; j++)
      f[x][j] = true;
    k -= 2;
  }
  ji = 1;
  ou = 2;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (f[i][j]) {
        a[i][j] = ji;
        ji += 2;
      } else {
        a[i][j] = ou;
        ou += 2;
      }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) cout << a[i][j] << " ";
    cout << endl;
  }
  return 0;
}