//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;
for(int j=0;j<min(n,i12);j++){
for(int i=0;i<=12;i++){
if(i==j) continue;
cout<<i<<" ";
}cout<<"\n";
}
for(int j=0;j<min(n-12,i12);j++){
for(int i=0;i<=12;i++){
if(i==j) continue;
cout<<i<<" ";
}cout<<"\n";
}
for(int j=0;j<min(n-24,i12);j++){
for(int i=0;i<=12;i++){
if(i==j) continue;
cout<<i<<" ";
}cout<<"\n";
}
for(int j=0;j<min(n-36,i12);j++){
for(int i=0;i<=12;i++){
if(i==j) continue;
cout<<i<<" ";
}cout<<"\n";
}
}