#include <bits/stdc++.h>
long long a[550][550], c[550][550];
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i <= n + 2; i++) {
    for (int j = 0; j <= n + 2; j++) {
      a[i][j] = c[i][j] = 1;
    }
  }
  vector<int> primes;
  vector<bool> visited(100000, 0);
  for (int i = 2; i < 10000; i++) {
    if (!visited[i]) {
      primes.push_back(i);
      for (int j = i; j < 100000; j += i) {
        visited[j] = 1;
      }
    }
  }
  for (int i = 0; i <= n; i += 2) {
    a[0][i] = primes.back();
    primes.pop_back();
  }
  for (int i = 0; i <= n; i += 2) {
    a[i][0] = primes.back();
    primes.pop_back();
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      a[i][j] = a[i - 1][j - 1];
    }
  }
  for (int i = n + 1; i > 0; i -= 2) {
    c[0][i] = primes.back();
    primes.pop_back();
  }
  for (int i = n + 1; i > 0; i -= 2) {
    c[i][n + 1] = primes.back();
    primes.pop_back();
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      c[i][j] = c[i - 1][j + 1];
      a[i][j] *= c[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if ((i + j) % 2) {
        a[i][j] *= a[i - 1][j] * a[i + 1][j];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
}
