#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _dbg(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _dbg(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_dbg(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}
const int N=11;
int g[N][N];
int val[N];
int32_t main() {
    val[0]=1;
    int n;
    cin>>n;
    for(int i=1;i<n;++i){
        for(int pot=val[i-1]+1;;++pot){
            set<int> s;
            int cnt=1;
            s.insert(pot);
            forn(x,i){forn(y,x){cnt++;s.insert(val[x]+val[y]);}cnt++;s.insert(val[x]+pot);s.insert(val[x]);cnt++;}
            if(s.size()==cnt){
                val[i]=pot;
                break;
            }
        }
    }
    memset(g,-1,sizeof g);
    for(int i=1;i<=n;++i){
        vector<int> v(i-1);
        int mx=0;
        iota(v.begin(), v.end(),1);
        do{
            int c=0;
            for(int j=1;j<v.size();++j)c+=g[v[j-1]][v[j]];
            upx(mx,c);
        }while(next_permutation(v.begin(), v.end()));
        mx++;
        for(int j=1;j<i;++j)g[j][i]=g[i][j]=mx*val[j-1];
        g[i][i]=0;
    }
    for(int i=1;i<=n;++i){for(int j=1;j<=n;++j)cout<<g[i][j]<<' ';cout<<'\n';}

    return 0;
}
