#include <bits/stdc++.h>
using namespace std;
const int N = 22;
int n, a[N][N];
set<int> p;
int main() {
  scanf("%d", &n);
  int top = 0;
  for (int i = 0; i < n; ++i) {
    vector<int> cur;
    for (int j = 0; j < i; ++j) {
      ++top;
      if (j > 1)
        while (a[0][1] + top <= a[0][j] + a[i][0]) ++top;
      a[i][j] = a[j][i] = top;
      cur.push_back(top);
    }
    int offset = 0;
    if (i)
      for (int mc = cur[0] - 1; mc >= 0; --mc) {
        bool ok = true;
        for (int j : cur) {
          if (p.count(j - mc)) {
            ok = false;
            break;
          }
        }
        if (ok) {
          offset = mc;
          break;
        }
      }
    for (int j = 0; j < i; ++j) {
      a[i][j] = a[j][i] = cur[j] - offset;
      p.insert(cur[j] - offset);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      printf("%d%s", i == j ? 0 : a[i][j], j + 1 == n ? "\n" : " ");
    }
  }
}
