#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

ll calc(VVL d){
    int n = d.size();
    VI p(n);
    REP(i,n) p[i] = i;
    ll ret = 0;
    do {
        ll s = 0;
        REP(i,n-1) s += d[p[i]][p[i + 1]];
        chmax(ret, s);
    }while (next_permutation(ALL(p)));
    return ret;
}

int main() {
    ll n;
    cin >> n;

    VL a(n-1);
    a[0] = 1;
    a[1] = 2;
    FOR(i,2,n-2){
        set<int> st;
        REP(j,i) st.insert(a[j]);
        REP(j,i) REP(k,j) st.insert(a[j] + a[k]);
        FOR(x,1,1e5){
            if (st.count(x)) continue;
            bool ok = true;
            REP(j,i) if (st.count(x + a[j])) ok = false;
            if (ok){
                a[i] = x;
                break;
            }
        }
    }

    // REP(i,n-1) cout << a[i] << endl;

    VVL d(2, VL(2));
    d[0][1] = d[1][0] = 1;
    FOR(x,2,n-1){
        ll m = calc(d);
        REP(i,x) d[i].push_back((m + 1) * a[i]);
        d.push_back(VL());
        REP(i,x) d[x].push_back((m + 1) * a[i]);
        d[x].push_back(0);
    }

    REP(i,n){
        REP(j,n) cout << d[i][j] << " ";
        cout << endl;
    }


    return 0;
}
