#include <bits/stdc++.h>
using namespace std;
const int N = 5e2 + 10;
const int C = 1e4 + 10;
const int SC = 1e2 + 10;
int max(int a, int b) { return a > b ? a : b; }
int min(int a, int b) { return a > b ? b : a; }
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
long long int ans[N][N];
int n;
long long int f(int a, int b) {
  if (a < 0 || b < 0 || a >= n || b >= n)
    return 1;
  else
    return ans[a][b];
}
int main() {
  int tot;
  bitset<C> went;
  vector<int> prime;
  scanf("%d", &n);
  went.reset();
  prime.push_back(2);
  for (int i = 3; i < SC; i += 2) {
    if (!went[i]) {
      prime.push_back(i);
      for (int j = i * i; j < C; j += i << 1) went[j] = true;
    }
  }
  for (int i = SC + 1; i < C; i += 2)
    if (!went[i]) prime.push_back(i);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) ans[i][j] = 0;
  for (int i = 0; i < n; i++) {
    tot = min(i, n - i - 1);
    for (int j = -tot; j <= tot; j++) ans[i + j][i - j] = prime[i];
  }
  for (int i = -(n >> 1); i < ((n + 1) >> 1); i++) {
    tot = min(n - i - 1, n + i - 1);
    for (int j = max(i, -i); j <= tot; j++)
      ans[i + j][j - i] *= prime[i + n + (n >> 1)];
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (ans[i][j] == 0)
        ans[i][j] =
            lcm(lcm(f(i - 1, j), f(i, j - 1)), lcm(f(i + 1, j), f(i, j + 1))) +
            1;
  for (int i = 0; i < n; i++) {
    printf("%lld", ans[i][0]);
    for (int j = 1; j < n; j++) printf(" %lld", ans[i][j]);
    printf("\n");
  }
}
