#include <bits/stdc++.h>
using namespace std;
signed main() {
  vector<long long> v;
  long long t = 3;
  while (v.size() < 1000) {
    bool f = 1;
    for (long long i = 2; i * i <= t; i++)
      if (t % i == 0) f = 0;
    if (f) v.push_back(t);
    t++;
  }
  long long d1[500][500], d2[500][500], c = 0;
  for (long long i = -498; i < 500; i += 2) {
    for (long long j = -i; j + i < 500; j++) {
      if (0 <= j && j < 500 && 0 <= j + i && j + i < 500) d1[j][j + i] = v[c];
    }
    c++;
  }
  for (long long i = 0; i < 1000; i += 2) {
    for (long long j = 1000; i - j < 500; j--) {
      if (0 <= j && j < 500 && 0 <= i - j && i - j < 500) d2[j][i - j] = v[c];
    }
    c++;
  }
  long long n;
  cin >> n;
  long long dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (j) cout << " ";
      if ((i + j) % 2) {
        long long res = 1;
        set<long long> s;
        for (long long k = 0; k < 4; k++) {
          long long nx = j + dx[k], ny = i + dy[k];
          if (nx < 0 || ny < 0 || nx >= 500 || ny >= 500) continue;
          s.insert(d1[ny][nx]);
          s.insert(d2[ny][nx]);
        }
        for (auto z : s) {
          res *= z;
        }
        cout << res + 1;
      } else
        cout << d1[i][j] * d2[i][j];
    }
    cout << endl;
  }
  return 0;
}
