#pragma GCC optimize("Ofast","inline")
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"---------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
						For(_x,L,R)cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef vector <int> vi;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=100;
int n,m;
LL g[N][N];
LL gg[N][N];
int a[N];
LL rand48(){
	LL a=rand()&65535,b=rand()&65535,c=rand()&65535;
	return (a<<32)^(b<<16)^c;
}
unordered_map <LL,int> mp;
int p[N];
bool check(int i){
	For(j,1,i-1)
		For(k,j+1,i-1)
			if (a[j]+a[k]==a[i])
				return 0;
	For(j,1,i-1)
		For(k,j+1,i-1)
			For(t,1,i-1)
				if (a[j]+a[k]==a[t]+a[i])
					return 0;
	return 1;
}
LL ans[N*N]={0,
0,1,2,8,56,672,13440,443520,22176000,1507968000,
1,0,4,16,112,1344,26880,887040,44352000,3015936000,
2,4,0,32,224,2688,53760,1774080,88704000,6031872000,
8,16,32,0,392,4704,94080,3104640,155232000,10555776000,
56,112,224,392,0,8064,161280,5322240,266112000,18095616000,
672,1344,2688,4704,8064,0,268800,8870400,443520000,30159360000,
13440,26880,53760,94080,161280,268800,0,12862080,643104000,43731072000,
443520,887040,1774080,3104640,5322240,8870400,12862080,0,842688000,7313164692,
22176000,44352000,88704000,155232000,266112000,443520000,643104000,842688000,0,28424716692,
1507968000,3015936000,6031872000,10555776000,18095616000,30159360000,43731072000,7313164692,28424716692,0
};
int main(){
	n=read();
	if (n==10){
		For(i,1,n){
			For(j,1,n){
				cout<<ans[(i-1)*n+j]<<" ";
			}
			cout<<endl;
		}
		return 0;
	}
	a[0]=0,a[1]=1;
	For(i,2,n-1){
		a[i]=a[i-1]+1;
		while (!check(i))
			a[i]++;
	}
//	outarr(a,1,n-1);
	LL tmp=1;
	For(i,2,n){
		For(j,1,i-1)
			gg[i][j]=gg[j][i]=tmp*a[j];
		tmp*=a[i-1]+a[i-2]+1;
	}
	while (1){
		int flag=1;
		LL mod=rand48()%100000000LL+49900000000LL;
		For(i,1,n)
			For(j,1,n)
				g[i][j]=gg[i][j]%mod;
		For(i,1,n)
			For(j,i+1,n)
				if (!g[i][j])
					flag=0;
		if (flag){
			mp.clear();
			For(i,1,n)
				p[i]=i;
			do {
				if (p[1]>p[n])
					continue;
				LL tot=0;
				For(i,1,n-1)
					tot+=g[p[i]][p[i+1]];
				if (tot>100000000000LL||mp[tot]){
					flag=0;
					break;
				}
				mp[tot]++;
			} while (next_permutation(p+1,p+n+1));
		}
		if (flag){
			For(i,1,n){
				For(j,1,n){
					cout<<g[i][j]<<" ";
				}
				cout<<endl;
			}
			break;
		}
	}
	return 0;
}