#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
inline long long read() {
  char ch = getchar();
  long long x = 0, f = 0;
  while (ch < '0' || ch > '9') f |= ch == '-', ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return f ? -x : x;
}
int n;
long long w[11][11], hhh;
int main() {
  hhh = n = read();
  for (int i = (1); i <= (n); i++) {
    long long dif = hhh - 1;
    w[i][1] = 1;
    for (int j = (2); j <= (n); j++) w[i][j] = w[i][j - 1] + dif;
    w[i][i] = 0;
    hhh *= n;
  }
  for (int i = (1); i <= (n); i++) {
    for (int j = (1); j <= (n); j++) printf("%lld ", max(w[j][i], w[i][j]));
    puts("");
  }
}
