#include <bits/stdc++.h>
using namespace std;
int n;
long long twop[55];
long long ans[51][51];
int ord[15];
long long anst[101] = {
    0,   1,     2,      4,      8,      16,     32,     64,     128,    256,
    1,   0,     512,    1024,   2048,   4096,   8192,   16384,  32768,  65536,
    2,   512,   0,      131072, 262144, 524288, 479648, 194913, 913141, 325084,
    4,   1024,  131072, 0,      313111, 584961, 431697, 431335, 38956,  204874,
    8,   2048,  262144, 313111, 0,      317084, 361155, 164387, 529180, 192006,
    16,  4096,  524288, 584961, 317084, 0,      528039, 509411, 257802, 41798,
    32,  8192,  479648, 431697, 361155, 528039, 0,      685286, 892227, 143040,
    64,  16384, 194913, 431335, 164387, 509411, 685286, 0,      203235, 23515,
    128, 32768, 913141, 38956,  529180, 257802, 892227, 203235, 0,      737357,
    256, 65536, 325084, 204874, 192006, 41798,  143040, 23515,  737357, 0};
int main(void) {
  scanf("%d", &n);
  int sz = n * (n - 1) / 2;
  std::random_device rnd;
  std::mt19937_64 mt(rnd());
  vector<long long> vec;
  map<long long, int> cnt;
  while (1) {
    int pos = 0;
    vec.clear();
    cnt.clear();
    long long p = 1;
    while (vec.size() < sz) {
      long long val = mt() % 100000007LL;
      if (val == 0) continue;
      vec.push_back(val);
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        ans[i][j] = vec[pos];
        ans[j][i] = vec[pos];
        pos++;
      }
    }
    bool flag = true;
    for (int i = 0; i < n; i++) {
      ord[i] = i;
    }
    do {
      long long sum = 0;
      for (int i = 0; i < n - 1; i++) {
        sum += ans[ord[i + 1]][ord[i]];
      }
      if (sum > 100000000000LL) cnt[sum]++;
      if (cnt[sum] >= 3) {
        flag = false;
        break;
      }
    } while (next_permutation(ord, ord + n));
    if (flag) break;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      printf("%lld%c", ans[i][j], (j + 1) == n ? '\n' : ' ');
    }
  }
  return 0;
}
