#include<bits/stdc++.h>
using namespace std;

#define nn 14
#define ll long long 
ll road[nn][nn];
ll n;
ll rati[]={1,2,4,7,12,20,29,38,52,73};
ll M;
void outprint(){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			printf("%lld ",road[i][j]); 
		}
		puts("");
	}
	exit(0);
}

ll id[nn];
void solve(ll m){
	for(int i=0;i<m;i++) id[i]=i;
	do{
		ll ans=0;
		for(int i=0;i<m;i++) ans+=road[id[i]][id[(i+1)%m]];
		M=max(M,ans);
	}while(next_permutation(id,id+m));
}
int main(){
	srand(time(0));
	cin>>n;
	if(n==2){
		road[1][0]=road[0][1]=1;
		outprint();
	}
	while(1){
	road[0][1]=road[1][0]=1,road[1][2]=road[2][1]=2,road[0][2]=road[2][0]=3;
	for(int i=3;i<n;i++){
		solve(i);
		random_shuffle(rati,rati+i);
		for(int j=0;j<i;j++){
			road[j][i]=road[i][j]=(M)*rati[j];
		}
	}
	solve(n);
	if(M<1e11) 
	outprint();
}
	
	return 0;
} 