#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E17;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long &pos, long long val) { pos = max(pos, val); }
void Min(long long &pos, long long val) { pos = min(pos, val); }
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
unsigned int rnd() {
  static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
  unsigned int t;
  t = (x ^ (x << 11));
  x = y;
  y = z;
  z = w;
  return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
long long r() { return rnd() * 100 + rnd(); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  while (1) {
    long long a[n][n];
    for (long long i = 0; i <= n - 1; i++) {
      for (long long j = i + 1; j <= n - 1; j++) {
        a[i][j] = r() % ((long long)1E10) + 1;
      }
    }
    for (long long i = 0; i <= n - 1; i++) {
      for (long long j = 0; j <= i - 1; j++) {
        a[i][j] = a[j][i];
      }
      a[i][i] = 0;
    }
    long long v[n];
    for (long long i = 0; i <= n - 1; i++) v[i] = i;
    vector<long long> sum;
    do {
      long long c = 0;
      for (long long i = 0; i <= n - 2; i++) {
        c += a[v[i]][v[i + 1]];
      }
      sum.push_back(c);
    } while (next_permutation(v, v + n));
    sort(sum.begin(), sum.end());
    sum.erase(unique(sum.begin(), sum.end()), sum.end());
    if (sum.size() == n) {
      for (long long i = 0; i <= n - 1; i++) {
        for (long long j = 0; j <= n - 1; j++) {
          cout << a[i][j] << " ";
        }
        cout << endl;
      }
      return 0;
    }
  }
  return 0;
}
