//Rahman ve Rahim olan Allah'ın adıyla
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
#define mid (st+end)/2
using namespace std;
const int i12=12;
const int i24=24;
const int i36=36;
const int i48=48;
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int n,k=0;cin>>n;
if(n<13){
for(int i=n-1;i>=0;i--){
for(int j=12;j>=0;j--){
if(i!=j){
cout<<j<<" ";
}
}cout<<"\n";
}for(int i=0;i<12;i++){
cout<<i+13-n+1<<" ";
}
}else{
for(int i=0;i<=12;i++){
for(int j=0;j<=12;j++){
if(i!=j){
cout<<j<<" ";
}
}cout<<"\n";
}int indx=13;
if(n>13){
for(int i=0;i<n-13;i++){
for(int i=0;i<=10;i++){
cout<<i<<" ";
}cout<<indx<<"\n";indx++;
}
}
}
}