#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 M = 1e9 + 32719873, P = 1007;
  vector<vector<long long> > res(n);
  vector<long long> S(1, 1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      res[i].push_back(0);
      S.push_back(S.back() * P % M + 1);
    }
  }
  random_shuffle(S.begin(), S.end());
  random_shuffle(S.begin(), S.end());
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i < j) {
        res[i][j] = res[j][i] = S.back();
        S.pop_back();
      }
      cout << res[i][j] << " \n"[j == n - 1];
    }
  }
}
