#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,        76177791, 81960052, 99426439, 96535600, 53307630, 15778277,
    22093975, 42571248, 67704159, 76177791, 0,        94951961, 18416517,
    78109805, 64839466, 75954049, 19662704, 65993871, 11493305, 81960052,
    94951961, 0,        21298639, 61257445, 44156100, 51422718, 23340151,
    26788606, 32661905, 99426439, 18416517, 21298639, 0,        4943240,
    19687539, 76990166, 63843335, 18417234, 3835476,  96535600, 78109805,
    61257445, 4943240,  0,        81794262, 31443095, 93828397, 61560595,
    76197179, 53307630, 64839466, 44156100, 19687539, 81794262, 0,
    7850275,  22911411, 16473544, 77855498, 15778277, 75954049, 51422718,
    76990166, 31443095, 7850275,  0,        75756895, 93671625, 2344865,
    22093975, 19662704, 23340151, 63843335, 93828397, 22911411, 75756895,
    0,        37903776, 75453789, 42571248, 65993871, 26788606, 18417234,
    61560595, 16473544, 93671625, 37903776, 0,        89565503, 67704159,
    11493305, 32661905, 3835476,  76197179, 77855498, 2344865,  75453789,
    89565503, 0};
int main(void) {
  scanf("%d", &n);
  if (n == 10) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        printf("%lld%c", anst[j + i * n], j + 1 == n ? '\n' : ' ');
      }
    }
    return 0;
  }
  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;
}
