#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

typedef long long ll;

//const int n=10;
int n;

ll w[10][10];
__gnu_pbds::gp_hash_table<ll,char> got;

bool bad;
int p[10];

int best=0;

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    scanf("%d",&n);
    for (int cnum=0; 1; cnum++) {
        mt19937 rng(cnum);
        uniform_int_distribution<ll> uid(1,12800000000LL);
        uniform_int_distribution<int> uid2(1,n);
        uniform_int_distribution<int> uid3(-10,10);
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                if (i==j) continue;
                w[i][j]=uid(rng);
            }
        }
        for (int i=0; i<n; i++) p[i]=i;
        for (int d=0; d<1000; d++) {
            bad=0;
            got.clear();
            do {
                if (p[0]>p[n-1]) continue;
                ll t=0;
                for (int i=1; i<n; i++) {
                    t+=w[p[i-1]][p[i]];
                }
                if (t>100000000000LL || got.find(t)!=got.end()) {
                    bad=1;
                    break;
                }
                else got[t]=1;
            } while (next_permutation(p,p+n));
            if (best<got.size()) {
                best=got.size();
                //printf("%d %d %d\n",cnum,d,best);
            }
            if (bad) {
                int i=uid2(rng);
                ll &x=w[p[i-1]][p[i]];
                x+=uid3(rng);
                if (x<1) x=1;
                continue;
            }
            //printf("%d %d\n",cnum,d);
            //freopen("out.txt","w",stdout);
            for (int i=0; i<n; i++) {
                for (int j=0; j<n; j++) {
                    printf("%lld ",w[i][j]);
                }
                printf("\n");
            }
            return 0;
        }
    }
}
