#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, sum = 0;
  char x = getchar();
  for (; (x < '0' || x > '9'); x = getchar())
    if (x == '-') f = -1;
  for (; x >= '0' && x <= '9'; x = getchar()) sum = sum * 10 + x - '0';
  return f * sum;
}
int n;
long long a[505][505];
int prime[8000 + 5];
bool notprime[8000 + 5];
map<long long, bool> cc;
void get_prime() {
  for (int i = 2; i <= 8000; ++i) {
    if (!notprime[i]) prime[++prime[0]] = i;
    for (int j = 1; j <= prime[0]; ++j) {
      if (i * prime[j] > 8000) break;
      notprime[i * prime[j]] = 1;
      if (!(i % prime[j])) break;
    }
  }
}
inline long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
inline long long Lcm(long long x, long long y) { return x / gcd(x, y) * y; }
int main() {
  n = read();
  if (n == 2) {
    puts("4 7");
    puts("23 10");
    return 0;
  }
  get_prime();
  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 (!(i + j & 1))
        a[i][j] =
            prime[(i + j) / 2] * prime[1000 - (i - j) / 2 - (n + 1) / 2 + 1];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (i + j & 1)
        a[i][j] =
            Lcm(Lcm(a[i - 1][j], a[i][j - 1]), Lcm(a[i][j + 1], a[i + 1][j])) +
            1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) printf("%lld ", a[i][j]);
    puts("");
  }
}
