#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

int n;
ll num[10];
ll num2[10];
ll out[10][10];
ll hoge[10];

int main() {
    cin >> n;
    if (n == 2) {
        cout << 0 << " " << 1 << endl;
        cout << 1 << " " << 0 << endl;
        return 0;
    }
    num[0] = 1;
    for (int i = 1; i <= n-1; i++) {
        for (int j = num[i-1]+i;; j++) {
            bool ok = true;
            for (int k = 0; k < i; k++) {
                for (int l = k+1; l < i; l++) {
                    if (num[k]+num[l] == j) {
                        ok = false;
                        break;
                    }
                    for (int z = 0; z < i; z++) {
                        if (num[k]+num[l] == j+num[z]) {
                            ok = false;
                            break;
                        }
                    }
                }
            }
            if (ok) {
                num[i] = j;
                break;
            }
        }
    }
    num2[0] = 1;
    for (int i = 1; i <= n-1; i++) {
        for (int j = num2[i-1]+i;; j++) {
            bool ok = true;
            for (int k = 0; k < i; k++) {
                for (int l = k+1; l < i; l++) {
                    for (int z = 0; z < i; z++) {
                        if (num2[k]+num2[l] == j+num2[z]) {
                            ok = false;
                            break;
                        }
                    }
                }
            }
            if (ok) {
                num2[i] = j;
                break;
            }
        }
    }
    ll base = 1;
    ll m_c = 0;
    ll acc = 0;
    /*
    rep(i,n) cerr << num[i] << " ";
    cerr << endl;
    */
    rep(i,n) {
        if (i == 0) {
            for (int j = 1; j < n; j++) {
                out[i][j] = num2[j-1];
            }
        } else {
            ll c = 0;
            rep(j,n) {
                if (i == j) {
                    continue;
                }
                if (out[j][i] != 0) continue;

                out[i][j] = base*num[c];
                m_c = max(m_c,out[i][j]);
                c++;
            }
        }
        ll sum = 0;
        rep(j,n) hoge[j] = 0;
        for (int j = i; j >= 0; j--) {
            int ccnt = 0;
            for (int k = n-1; k > j; k--) {
                if (hoge[k] <= 1 && hoge[j] <= 1) {
                    sum += out[j][k];
                    hoge[k]++;
                    hoge[j]++;
                    ccnt++;
                }
                if (ccnt == 2) break;
            }
        }
        base = sum+1;
        //if (c >= 2) base = base*(num[c-2]+num[c-1]+1);
        //else if (c == 1) base = base*(num[c-1]+1);
        //base = base*(num[4]+num[3]+1);
        //cerr << base << endl;
    }
    cerr << m_c << endl;
    rep(i,n) {
        rep(j,n) {
            out[i][j] = max(out[i][j], out[j][i]);
            cout << out[i][j];
            if (j != n-1) cout << " ";
            else cout << endl;
        }
    }
    int hoge[10];
    rep(i,10) hoge[i] = i;
    unordered_map<ll,int> checker;
    ll val = 0;
    do{ 
        ll cnt = 0;
        rep(i,9) cnt += out[hoge[i]][hoge[i+1]];
        if (checker[cnt] > 1) {
            cerr << "fail" << endl;
            break;
        }
        checker[cnt]++;
        val = max(cnt, val);
    } while(next_permutation(hoge, hoge+n));
    cerr<< val << endl;
}
