#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) {
  if (!b) return a;
  for (register long long r = a % b; r; r = a % b) a = b, b = r;
  return b;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int dx[4] = {-1, 0, +1, 0}, dy[4] = {0, -1, 0, +1};
int n, m, i, j, k, pn, p[2000];
bool np[2000 + 1];
long long a[500][500];
inline bool chk(int i) { return i >= 0 && i < n; }
int main() {
  m = 2000;
  for (i = 2; i <= m; ++i) {
    if (!np[i]) p[pn++] = i;
    for (k = 0; (j = i * p[k]) <= m; ++k) {
      np[j] = true;
      if (i % p[k] == 0) break;
    }
  }
  scanf("%d", &n);
  if (n == 2)
    puts("4 7\n23 10");
  else {
    k = 0;
    for (i = 0; i < n; ++i)
      for (j = i & 1; j < n; j += 2)
        if (!i && !j)
          a[i][j] = 2;
        else
          a[i][j] = 2 * p[i / 2 + 1] * p[j / 2 + 1] * (1 + (i < j));
    for (i = 0; i < n; ++i)
      for (j = (i & 1) ^ 1; j < n; j += 2) {
        a[i][j] = 1;
        for (k = 0; k < 4; ++k)
          if (chk(i + dx[k]) && chk(j + dy[k]))
            a[i][j] = lcm(a[i][j], a[i + dx[k]][j + dy[k]]);
        ++a[i][j];
      }
    for (i = 0; i < n; ++i)
      for (j = 0; j < n; ++j) printf("%lld%c", a[i][j], j < n - 1 ? ' ' : '\n');
  }
  return 0;
}
