#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 0;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
const int N = 1005, lim = N * 10;
int flag[lim], p[N], n, cnt;
int main() {
  read(n), p[++cnt] = 1;
  for (int i = 2; cnt <= n * 2; i++)
    if (!flag[i]) {
      p[++cnt] = i;
      for (int j = i * i; j < lim; j += i) flag[j] = 1;
    }
  for (int i = (1); i <= (n); i++) {
    for (int j = (1); j <= (n); j++)
      if ((i + j) & 1) {
        long long res = (long long)p[(i + j - 1) / 2] * p[(i + j + 1) / 2];
        res *=
            (long long)p[(i + 3 * n - j - 1) / 2] * p[(i + 3 * n - j + 1) / 2];
        printf("%lld ", res + 1);
      } else {
        long long res = (long long)p[(i + j) / 2] * p[(i - j + 3 * n) / 2];
        printf("%lld ", res);
      }
    puts("");
  }
  return 0;
}
