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 mod = 2012;
const int N = 400010;
const int INF = 0x3f3f3f3f;
int a[555][555];
int main() {
  int n;
  scanf("%d", &n);
  int flag = 1;
  int sx = 200, sy = 200;
  a[sx][sy] = 1;
  int tl = 2;
  for (int k = 3; k <= n; k += 2) {
    if (flag) {
      sx--, sy--;
      for (int i = sy; i < sy + k; i++) a[sx][i] = tl++;
      for (int i = sx + 1; i < sx + k; i++) a[i][sy + k - 1] = tl++;
      for (int i = sy + k - 2; i >= sy; i--) a[sx + k - 1][i] = tl++;
      for (int i = sx + k - 2; i > sx; i--) a[i][sy] = tl++;
    } else {
      sx--, sy--;
      for (int i = sy + 1; i < sy + k; i++) a[sx][i] = tl++;
      for (int i = sx + 1; i < sx + k; i++) a[i][sy + k - 1] = tl++;
      for (int i = sy + k - 2; i >= sy; i--) a[sx + k - 1][i] = tl++;
      for (int i = sx + k - 2; i > sx; i--) a[i][sy] = tl++;
      a[sx][sy] = tl++;
    }
    flag ^= 1;
  }
  for (int i = sx; i < sx + n; i++, printf("\n"))
    for (int j = sy; j < sy + n; j++) {
      printf("%d ", a[i][j]);
    }
  return 0;
}