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>
int map[49][49];
int n;
short odd_map[49][49];
int direction[4][2] = {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
void debug() {
  printf("\n");
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      printf("%d ", odd_map[i][j]);
    }
    printf("\n");
  }
}
int main() {
  scanf("%d", &n);
  int mid = n >> 1;
  int it = 1;
  int oddRemain = (n * n + 1) >> 1;
  for (int i = 0; i < n; i++) {
    map[mid][i] = it;
    it += 2;
    oddRemain--;
    odd_map[mid][i] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (i == mid) {
      continue;
    }
    map[i][mid] = it;
    it += 2;
    oddRemain--;
    odd_map[i][mid] = 1;
  }
  int diff_x = 2, diff_y = 1;
  while (oddRemain > 4 && diff_x <= mid) {
    for (int i = 0; i < 4; i++) {
      map[mid + direction[i][0] * diff_x][mid + direction[i][1] * diff_y] = it;
      it += 2;
      oddRemain--;
      map[mid + direction[i][0] * diff_y][mid + direction[i][1] * diff_x] = it;
      it += 2;
      oddRemain--;
      odd_map[mid + direction[i][0] * diff_x][mid + direction[i][1] * diff_y] =
          1;
      odd_map[mid + direction[i][0] * diff_y][mid + direction[i][1] * diff_x] =
          1;
    }
    diff_y++;
    if (diff_y == diff_x) {
      diff_x++;
      diff_y = 1;
    }
  }
  int diff_diag = 1;
  while (oddRemain > 0) {
    for (int i = 0; i < 4; i++) {
      map[mid + direction[i][0] * diff_diag]
         [mid + direction[i][1] * diff_diag] = it;
      it += 2;
      oddRemain--;
      odd_map[mid + direction[i][0] * diff_diag]
             [mid + direction[i][1] * diff_diag] = 1;
    }
  }
  it = 2;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (map[i][j] == 0) {
        map[i][j] = it;
        it += 2;
      }
      printf("%d ", map[i][j]);
    }
    printf("\n");
  }
  return 0;
}