#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;
}
