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, A[49][49], i, j, x, y, count;
  cin >> n;
  y = n / 2;
  for (i = 1, A[24][24] = 1, count = 1; i <= y; i++) {
    if (i % 2 == 1) {
      A[24 - i][24 + i] = ++count;
      for (j = 24 - i, x = 24 - (i - 1); x <= (24 + (i - 1)); x++)
        A[j][x] = ++count;
      A[24 + i][24 + i] = ++count;
      for (j = 24 - (i - 1), x = 24 + i; j <= (24 + (i - 1)); j++)
        A[j][x] = ++count;
      A[24 + i][24 - i] = ++count;
      for (j = 24 + i, x = 24 + (i - 1); x >= (24 - (i - 1)); x--)
        A[j][x] = ++count;
      A[24 - i][24 - i] = ++count;
      for (j = 24 + (i - 1), x = 24 - i; j >= (24 - (i - 1)); j--)
        A[j][x] = ++count;
    } else {
      for (j = 24 - i, x = 24 - (i - 1); x <= (24 + (i - 1)); x++)
        A[j][x] = ++count;
      A[24 - i][24 + i] = ++count;
      for (j = 24 - (i - 1), x = 24 + i; j <= (24 + (i - 1)); j++)
        A[j][x] = ++count;
      A[24 + i][24 + i] = ++count;
      for (j = 24 + i, x = 24 + (i - 1); x >= (24 - (i - 1)); x--)
        A[j][x] = ++count;
      A[24 + i][24 - i] = ++count;
      for (j = 24 + (i - 1), x = 24 - i; j >= (24 - (i - 1)); j--)
        A[j][x] = ++count;
      A[24 - i][24 - i] = ++count;
    }
  }
  for (i = 24 - y; i <= 24 + y; i++) {
    for (j = 24 - y; j <= 24 + y; j++) cout << A[i][j] << " ";
    cout << endl;
  }
}