#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "../benri.h"
#else
#define out
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7; //998244353

ll re[10][10];

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	const vector<ll> arr{1, 2, 4, 7, 12, 20, 33, 54, 88, 143, 232};

	{
		map<int,pii> mp;
		rep(i,arr.size())rep(j,i){
			int s=arr[i]+arr[j];
			if(mp.count(s)){ out(i,j,mp[s],s,1); break;}
			mp[s]=pii(i,j);
		}
		out(mp.size()==arr.size()*(arr.size()-1)/2,1);
	}
	// vector<ll> co{0,1,2};
	// reps(i,2,11) co.pb(co.back()*(arr[i-1]+arr[i-2]+1));
	// out(co,1);
	ll co=1;
	reps(i,1,10){
		out(i,co,1);
		rep(j,i){
			ll w=arr[j]*co;
			re[i][j]=re[j][i]=w;
		}
		co=*max_element(re[0],re[10])*2;
	}
	out(*max_element(re[0],re[1]),1);
	out(arr[5]+arr[6],arr[4]+arr[7],1);
	out(re[4][9]+re[9][7]+re[5][8]+re[8][6],1);
	out(re[4][8]+re[8][7]+re[5][9]+re[9][6],1);
	// reps(N,2,10){
	// 	map<ll,vector<int>> st;
	// 	vector<int> ind(N); iota(all(ind),0);
	// 	do{
	// 		if(ind[0]>ind.back()) continue;
	// 		ll s=0;
	// 		reps(i,1,ind.size()) s+=re[ind[i-1]][ind[i]];
	// 		if(st.count(s)){ out(ind,st[s],1); return 0;}
	// 		st[s]=ind;
	// 	}while(next_permutation(all(ind)));
	// 	out("ok",st.rbegin()->X,1);
	// }
	int n;
	cin>>n;
	rep(i,n){rep(j,n) cout<<re[i][j]<<" \n"[j+1==n];}
  return 0;
}
/*
 {0,1,2,3,4,9,7,5,8,6,}
 {0,1,2,3,4,8,7,5,9,6,}

*/
