#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "inline")
using namespace std;
long long read() {
  long long x = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) f |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
const int N = 15;
int n, m;
long long g[N][N];
long long pw[N * N];
long long rand48() {
  long long a = rand() & 65535, b = rand() & 65535, c = rand() & 65535;
  return (a << 32) ^ (b << 16) ^ c;
}
int p[N];
unordered_map<long long, int> mp;
int main() {
  srand(233);
  n = read(), m = n * (n - 1) / 2;
  while (1) {
    long long mod = rand48() % 10000000000LL + 99000000000;
    for (int i = (1); i <= (m); i++) pw[i] = 1LL << (i - 1);
    random_shuffle(pw + 1, pw + m + 1);
    int c = 0;
    for (int i = (1); i <= (n); i++)
      for (int j = (i + 1); j <= (n); j++) g[i][j] = g[j][i] = pw[++c] % mod;
    int flag = 1;
    for (int i = (1); i <= (n); i++)
      for (int j = (i + 1); j <= (n); j++)
        if (!g[i][j]) flag = 0;
    if (!flag) continue;
    mp.clear();
    for (int i = (1); i <= (n); i++) p[i] = i;
    do {
      if (p[1] > p[n]) continue;
      long long tot = 0;
      for (int i = (1); i <= (n - 1); i++) tot += g[p[i]][p[i + 1]];
      if (mp[tot]) {
        flag = 0;
        break;
      }
      mp[tot] = 1;
    } while (!next_permutation(p + 1, p + n + 1));
    if (flag) {
      for (int i = (1); i <= (n); i++) {
        for (int j = (1); j <= (n); j++) cout << g[i][j] << " ";
        cout << endl;
      }
      break;
    }
  }
  return 0;
}
