#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const int M = 100000;
int noLin, noPrimes;
vector<int> allPrimes;
int isPrime[M];
int diagPrin[N], diagSec[N];
long long mat[N][N];
void genCiur() {
  int i;
  for (i = 2; i * i < M; i++) {
    if (isPrime[i] == 0) {
      allPrimes.push_back(i);
    }
    for (int j = i * i; j < M; j += i) {
      isPrime[j] = 1;
    }
  }
  for (; i < M; i++) {
    if (isPrime[i] == 0) {
      allPrimes.push_back(i);
    }
  }
}
long long cmmdc(long long a, long long b) {
  while (b) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}
long long calcLCM(long long a, long long b) { return a * b / cmmdc(a, b); }
int main() {
  scanf("%d", &noLin);
  noPrimes = 2 * noLin + 1;
  genCiur();
  vector<int>::iterator it = allPrimes.begin();
  for (int crLin = 0; crLin < noLin; crLin += 2) {
    int i = crLin;
    for (int j = 0; j < noLin && i < noLin; i++, j++) {
      mat[i][j] = *it;
    }
    it++;
  }
  for (int crCol = 2; crCol < noLin; crCol += 2) {
    int j = crCol;
    for (int i = 0; j < noLin; i++, j++) {
      mat[i][j] = *it;
    }
    it++;
  }
  for (int crCol = 0; crCol < noLin; crCol += 2) {
    int i = crCol;
    for (int j = 0; i >= 0 && j < noLin; i--, j++) {
      mat[i][j] *= *it;
    }
    it++;
  }
  for (int crLin = noLin - 1; crLin >= 0; crLin -= 2) {
    int i = crLin;
    for (int j = noLin - 1; i < noLin; i++, j--) {
      mat[i][j] *= *it;
    }
    it++;
  }
  for (int i = 0; i < noLin; i++) {
    for (int j = 0; j < noLin; j++) {
      long long a = 1, b = 1, c = 1, d = 1;
      if (mat[i][j] == 0) {
        if (i) {
          a = mat[i - 1][j];
        }
        if (j) {
          b = mat[i][j - 1];
        }
        if (i < noLin - 1) {
          c = mat[i + 1][j];
        }
        if (j < noLin - 1) {
          d = mat[i][j + 1];
        }
        a = calcLCM(a, b);
        a = calcLCM(a, c);
        a = calcLCM(a, d);
        mat[i][j] = a + 1;
      }
    }
  }
  for (int i = 0; i < noLin; i++) {
    for (int j = 0; j < noLin; j++) {
      printf("%I64d ", mat[i][j]);
    }
    printf("\n");
  }
  return 0;
}
