#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int N = 500;
  int M = 100 * N;
  bool prime[M];
  for (int i = 1; i < M; i++) prime[i] = true;
  for (int i = 2; i < M; i++)
    if (prime[i])
      for (int j = i + i; j < M; j += i) prime[j] = false;
  vector<int> p;
  for (int i = 2; i < M; i++)
    if (prime[i]) {
      p.push_back(i);
      cout << i << " ";
    }
  vector<long long> a(N + 1);
  long long x = 0;
  for (int i = 0; i <= N; i += 4) a[i] = p[i / 4];
  for (int i = 2; i <= N; i += 4) a[i] = p[N / 2 - i / 4];
  for (int i = 1; i < N; i += 2) {
    a[i] = a[i - 1] * a[i + 1];
    x = max(x, a[i]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cout << a[n - 1 - i] * a[j] * a[j] << " ";
    cout << endl;
  }
  return 0;
}
