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;
const int MAXN = 50;
int p[2];
bool a[MAXN][MAXN];
vector<int> A[2];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n * n; i++) A[i & 1].push_back(i);
  if (n & 1) {
    if (n % 4 == 3) {
      for (int i = 2; i <= n; i += 2)
        for (int j = 1; j <= n; j++) a[i][j] = 1;
      for (int i = 1; i <= n; i++) a[i][(n + 1) >> 1] = 1;
    } else {
      int k = n / 2;
      for (int i = 1; i <= k; i++)
        for (int j = 1; j <= k; j++) a[i][j] = a[i + k + 1][j + k + 1] = 1;
      for (int i = 1; i <= n; i++) a[i][n + 1 - i] = 1;
    }
  } else {
    for (int i = 2; i < n; i++)
      for (int j = 2; j < n; j++) a[i][j] = (i + j) & 1;
    for (int i = 1; i <= n; i++) a[1][i] = 1;
    for (int i = 1; i < n; i++) a[i][1] = 1;
    swap(a[1][n - 1], a[n][n - 1]);
    if (n % 4 == 0) {
      for (int i = 2; i < n; i++)
        if (i % 2 == 0)
          a[i][1] = a[i][n] = 1;
        else
          a[i][1] = a[i][n] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      int x = a[i][j];
      cout << A[x][p[x]++] << ' ';
    }
    cout << '\n';
  }
  return 0;
}