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 a[60][60];
int odd[3000];
int even[3000];
int op, ep;
int fin[3000];
int T;
void Init() {
  memset(a, 0, sizeof(a));
  memset(odd, 0, sizeof(odd));
  memset(even, 0, sizeof(even));
  op = 0, ep = 0;
  for (int i = 1; i <= T * T; i++) {
    if (i & 1)
      odd[++op] = i;
    else
      even[++ep] = i;
  }
}
int cd, cp;
void cross() {
  int pp = (T + 1) / 2;
  for (int i = 1; i <= T; i++) {
    a[pp][i] = odd[++cd];
  }
  for (int i = 1; i <= T; i++) {
    if (!a[i][pp]) a[i][pp] = odd[++cd];
  }
}
void cross_o() {
  int num = (T * T + 1) / 2;
  if (cd < num) {
    int i = 0, j = 1;
    int p = T + 1, q = 1;
    for (int cnt = 1; cnt <= T; cnt++) {
      if (cnt & 1) {
        i++;
        for (j = 1; j <= T; j++) {
          if (i == j && !a[i][j]) a[i][j] = odd[++cd];
          if (i == (T - j + 1) && (!a[i][j])) {
            a[i][j] = odd[++cd];
          }
        }
      } else {
        p--;
        for (q = 1; q <= T; q++) {
          if (p == q && !a[p][q]) a[p][q] = odd[++cd];
          if (p == (T - q + 1) && (!a[p][q])) {
            a[p][q] = odd[++cd];
          }
        }
      }
    }
  }
}
void odd_put() {
  if (cd < (T * T + 1) / 2) {
    for (int i = 1; i <= T; i++) {
      if (cd > (T * T + 1) / 2) break;
      for (int j = 1; j <= T; j++) {
        if (!a[i][j]) {
          a[i][j] = odd[++cd];
          a[i][T - j + 1] = odd[++cd];
          a[T - i + 1][j] = odd[++cd];
          a[T - i + 1][T - j + 1] = odd[++cd];
        }
      }
    }
  }
}
void even_put() {
  for (int i = 1; i <= T; i++) {
    for (int j = 1; j <= T; j++) {
      if (!a[i][j]) {
        a[i][j] = even[++cp];
      }
    }
  }
}
void out() {
  for (int i = 1; i <= T; i++) {
    for (int j = 1; j <= T; j++) {
      printf("%d ", a[i][j]);
    }
    printf("\n");
  }
  printf("\n");
}
int main() {
  while (cin >> T) {
    cd = 0, cp = 0;
    Init();
    cross();
    cross_o();
    odd_put();
    even_put();
    out();
  }
  return 0;
}