#include <bits/stdc++.h>
using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int run = 0;
vi seen(100);

bool find(vi& took, int lim, int inx) {
    if (inx == sz(took)) {
        ++run;

        for (int i = 0; i < sz(took); i++) {
            if (seen[took[i]] == run) return false;
            else seen[took[i]] = run;

            for (int j = 0; j < i; j++) {
                if (seen[took[i] + took[j]] == run) return false;
                else seen[took[i] + took[j]] = run;
            }
        }

        return true;
    }

    int low = inx ? took[inx - 1] : 0;
    for (took[inx] = low + 1; took[inx] + low < lim; took[inx]++) {
        if (find(took, lim, inx + 1))
            return true;
    }
    return false;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    vi lim = { 0, 2, 4, 7, 12, 20, 32, 44, 64, 81 };

    int N;
    cin >> N;

    vvll dist(N, vll(N));

    ll mv = 1;
    for (int n = 1; n < N; n++) {
        vi took(n);
        find(took, lim[n], 0);
        for (int i = 0; i < n; i++)
            dist[i][n] = mv * took[i];
        mv *= lim[n];
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (j) cout << " ";
            cout << dist[min(i, j)][max(i, j)];
        }
        cout << "\n";
    }

    return 0;
}

