#include <bits/stdc++.h>
using namespace std;
namespace RA {
int r(int p) { return 1ll * rand() * rand() % p; }
int r(int L, int R) { return r(R - L + 1) + L; }
}  // namespace RA
namespace IO {
char nc() {
  static char bf[100000], *p1 = bf, *p2 = bf;
  return p1 == p2 && (p2 = (p1 = bf) + fread(bf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
int rd() {
  int res = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) res = res * 10 + c - '0', c = getchar();
  return res;
}
}  // namespace IO
const int N = 11;
int w[N][N];
int mx[N];
void getmax(int x) {
  int p[N];
  for (int i = (1); i <= (x); ++i) p[i] = i, mx[i] = 0;
  do {
    int s = 0;
    for (int i = (1); i <= (x - 1); ++i) s += w[p[i]][p[i + 1]];
    mx[p[1]] = max(mx[p[1]], s);
  } while (next_permutation(p + 1, p + x + 1));
}
int mn[N];
void getmin(int x) {
  int p[N];
  for (int i = (1); i <= (x); ++i) p[i] = i, mn[i] = 0x3f3f3f3f;
  do {
    int s = 0;
    for (int i = (1); i <= (x - 1); ++i) s += w[p[i]][p[i + 1]];
    mn[p[1]] = min(mn[p[1]], s);
  } while (next_permutation(p + 1, p + x + 1));
}
int main() {
  int n;
  cin >> n;
  for (int i = (2); i <= (n); ++i) {
    getmin(i - 1), getmax(i - 1);
    int last = 0;
    for (int j = (1); j <= (i - 1); ++j) {
      w[i][j] = w[j][i] = max(1, last - mn[j] + 1);
      last = w[i][j] + mx[j];
    }
  }
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (n); ++j) printf("%d%c", w[i][j], " \n"[j == n]);
  return 0;
}
