#include <stdio.h>
int gray(int g) {
return g^(g>>1);
}
int pow(int n) {
int res=1;
for(int i=0; i<n; i++) res*=2;
return res;
}
int main() {
freopen("gray.in", "r", stdin);
freopen("gray.out", "w", stdout);
int n, x=0;
scanf("%d", &n);
int div=0,mod=0, h=0, bin[30];
for(int i=0; i<30; i++) bin[i]=0;
for(int i=0; i< pow(n); i++) {
x=gray(i);
while(x>0) {
bin[h]=x%2;
x=x/2;
++h;
}
h=n;
for(int j=h-1; j>=0; j--) printf("%d ", bin[j]);
h=0;
printf("\n");
}
return 0;
}