#include <bits/stdc++.h>
using namespace std;
bool bz[500010];
int gs, n;
long long b[510][510], c[510][501], ans[510][510], zs[500010];
int fx[4][2] = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  for (int i = 2; i <= 500000; i++) {
    if (!bz[i]) {
      gs++;
      zs[gs] = i;
      for (int j = 1; j <= 500000 / i; j++) {
        bz[j * i] = true;
      }
    }
  }
  scanf("%d", &n);
  if (n == 2) {
    printf("4 7\n");
    printf("23 10\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (i % 2 == 1) {
      int x = 1;
      int y = i;
      while (x <= n && y <= n) {
        b[x][y] = zs[i];
        x++;
        y++;
      }
      if (i == 1) continue;
      x = i;
      y = 1;
      while (x <= n && y <= n) {
        b[x][y] = zs[i - 1];
        x++;
        y++;
      }
    }
  }
  for (int i = n; i >= 1; i--) {
    if (i % 2 == 1) {
      int x = 1;
      int y = i;
      while (x <= n && y >= 1) {
        c[x][y] = zs[n + n - i + 1];
        x++;
        y--;
      }
      if (i == n) continue;
      if (n % 2 == 0)
        x = n - i + 1;
      else
        x = n - i + 1;
      y = n;
      while (x <= n && y >= 1) {
        c[x][y] = zs[n + n - i];
        x++;
        y--;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if ((i + j) % 2 == 0) {
        ans[i][j] = b[i][j] * c[i][j];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if ((i + j) % 2 == 1) {
        int op = 0;
        for (int k = 0; k <= 3; k++) {
          int x = i + fx[k][0];
          int y = j + fx[k][1];
          if (x >= 1 && x <= n && y >= 1 && y <= n) {
            if (op == 0)
              op = ans[x][y];
            else
              op = lcm(op, ans[x][y]);
          }
        }
        ans[i][j] = op + 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      printf("%lld ", ans[i][j]);
    }
    printf("\n");
  }
}
