#include <bits/stdc++.h>
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c <= '9' && c >= '0') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
void print(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
const int maxn = 20007;
int n;
int prime[maxn];
bool vis[maxn];
void pre(int lim = 10000) {
  for (int cnt = 0, i = 2; i <= lim; ++i) {
    if (!vis[i]) prime[++cnt] = i;
    for (int j = 1; j <= cnt && prime[j] * i <= lim; ++j) {
      vis[i * prime[j]] = 1;
      if (i % prime[j] == 0) break;
    }
  }
}
long long a[507][507];
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
int main() {
  n = read();
  pre();
  if (n == 2) {
    putchar('4');
    putchar(' ');
    putchar('7');
    putchar('\n');
    print(23);
    putchar(' ');
    print(10);
    putchar('\n');
    return 0;
  }
  for (int i = 0; i <= n + 1; ++i)
    for (int j = 0; j <= n + 1; ++j) a[i][j] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      if ((j & 1) == (i & 1)) {
        a[i][j] = prime[(i + j) / 2] * prime[(i + n + 1 - j) / 2 + n];
        a[i + 1][j] = lcm(a[i + 1][j], a[i][j]);
        a[i - 1][j] = lcm(a[i - 1][j], a[i][j]);
        a[i][j + 1] = lcm(a[i][j + 1], a[i][j]);
        a[i][j - 1] = lcm(a[i][j - 1], a[i][j]);
      }
    }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if ((i & 1) == (j & 1))
        ;
      else
        a[i][j]++;
  for (int i = 1; i <= n; ++i, putchar('\n'))
    for (int j = 1; j <= n; ++j) print(a[i][j]), putchar(' ');
  return 0;
}
