#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
inline void Max(T &a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
inline void Min(T &a, U b) {
  if (a > b) a = b;
}
inline void add(int &a, int b) {
  a += b;
  while (a >= 1000000007) a -= 1000000007;
}
inline int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = ans * (long long)a % 1000000007;
    a = (long long)a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
int g[11][11], id[11], e[101];
void gen(int n) {
  int sz = n * (n - 1) / 2;
  random_shuffle(e, e + sz);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      g[i][j] = g[j][i] = e[--sz];
    }
  }
}
int main() {
  int j, k, i, T, ca = 0, m = 0, K = 0, n;
  scanf("%d", &n);
  int sz = 0;
  for (int i = 0; i < n; i++) {
    K = 1 << i + 1;
    for (int j = 0; j < i; j++) {
      e[sz++] = K++;
    }
  }
  for (int i = 0; i < n; i++) id[i] = i;
  map<long long, int> cnt;
  int ok = 0;
  while (!ok) {
    cnt.clear();
    gen(n);
    ok = 1;
    do {
      long long sum = 0;
      for (int i = 1; i < n; i++) {
        sum += g[id[i - 1]][id[i]];
      }
      cnt[sum]++;
      if (cnt[sum] > 1) {
        ok = 0;
        break;
      }
    } while (next_permutation(id, id + n));
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) printf("%d ", g[i][j]);
    puts("");
  }
}
