#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e11 + 1;
const int INF = 2e9;
const long long LINF = 4e18;
const long long delta = 96181;
const int N = 11;
long long a[N][N], fib[N * N], n, w[N][N];
vector<long long> ans, p = {3, 5, 7, 11, 13, 17, 19, 23, 29};
vector<pair<int, int> > e;
long long powmod(long long x, long long y) {
  long long res = 1;
  for (int i = 0; i < y; i++) res = (res * x) % MOD;
  return res;
}
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) e.push_back(make_pair(i, j));
  if (n <= 9) {
    for (long long i = 0; i < e.size(); i++)
      w[e[i].first][e[i].second] = w[e[i].second][e[i].first] = (1LL << i);
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) cout << w[i][j] << ' ';
      cout << endl;
    }
  } else {
    for (long long i = 9; i < e.size(); i++)
      w[e[i].first][e[i].second] = w[e[i].second][e[i].first] =
          (1LL << (i - 8));
    for (int i = 0; i < p.size(); i++) p[i] = powmod(p[i], 5);
    shuffle(p.begin(), p.end(), rng);
    for (long long i = 0; i < 9; i++)
      w[e[i].first][e[i].second] = w[e[i].second][e[i].first] = p[i];
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) cout << w[i][j] << ' ';
      cout << endl;
    }
  }
}
