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 ans[100][100];
bool vst[100][100];
int main() {
  int n;
  scanf("%d", &n);
  int k = n / 2;
  int t = k * (k + 1) / 2;
  int p = (int)(sqrt(t) + 1e-8);
  for (int i = 1; i <= p; i++) {
    for (int j = 1; j <= p; j++) vst[i][j] = 1;
  }
  int cnt = t - p * p;
  for (int i = 1; i <= p; i++) {
    if (cnt == 0) break;
    vst[p + 1][i] = 1;
    cnt--;
  }
  for (int i = 1; i <= p; i++) {
    if (cnt == 0) break;
    vst[i][p + 1] = 1;
    cnt--;
  }
  for (int i = 1; i <= p + 1; i++) {
    for (int j = 1; j <= p + 1; j++) {
      if (vst[i][j]) {
        vst[n - i + 1][j] = 1;
        vst[i][n - j + 1] = 1;
        vst[n - i + 1][n - j + 1] = 1;
      }
    }
  }
  int c1 = 2, c2 = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (vst[i][j])
        ans[i][j] = c1, c1 += 2;
      else
        ans[i][j] = c2, c2 += 2;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (j != n)
        cout << ans[i][j] << " ";
      else
        cout << ans[i][j] << endl;
    }
  }
  return 0;
}