#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
typedef pair<int,int>P;
typedef pair<int,P>P2;
#define F first
#define S second
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

unsigned long long xor128() {
    static unsigned long long rx = 123456789, ry = 362436069, rz = 521288629, rw = 88675123;
    unsigned long long rt = (rx ^ (rx << 11));
    rx = ry;
    ry = rz;
    rz = rw;
    return (rw = (rw ^ (rw >> 19)) ^ (rt ^ (rt >> 8)));
}

signed main(){
	int n;
	cin>>n;
	int a[n][n]={};
	r(i,n)r(j,n)if(i<j){
		int t=xor128()%100000000000;
		a[i][j]=a[j][i]=t;
	}
	vector<int>v;
	r(i,n)v.push_back(i);
	while(1){
		map<int,int>st;
		int f=0;
		do{
			int sum=0;
			r(i,n-1){
				sum+=a[v[i]][v[i+1]];
			}
			st[sum]++;
			if(st[sum]>2)f=1;
		}while(next_permutation(v.begin(),v.end()));
		if(!f)break;
		while(1){
			int x=xor128()%n;
			int y=xor128()%n;
			int t=xor128()%100000000000;
			if(x==y)continue;
			a[y][x]=a[x][y]=t;
			break;
		}
	}

	r(i,n){
		r(j,n){
			cout<<a[i][j]<<' ';
		}
		cout<<endl;
	}
}