#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e6+5;

ll read(){static ll x;scanf("%lld",&x);return x;}
void write(ll x){printf("%lld",x);}
void print(ll x,char c='\n'){write(x),putchar(c);}

int a[N],b[N];

signed main()
{
	int n=read();
	for (int i=0;i<n;i++) a[i]=i;
	for (int k=1;k<=20;k++)
	{
		int cnt=0;
		for (int i=0;i<n;i++) b[i]=a[i/2]*n+a[n-1-i/2];
		for (int i=0;i<n;i++) if (!i||b[i]!=b[i-1]) a[i]=cnt++; else a[i]=a[i-1];
		for (int i=0;i<n;i++) print(a[i]," \n"[i+1==n]);
	}
	
	return 0;
}
