#include <bits/stdc++.h>
const int N = 100100;
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  long long G = 5e9;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        cout << 0 << " ";
      } else {
        cout << G + min(i, j) * n + max(i, j) << " ";
      }
    }
    cout << "\n";
  }
}
