char s[99],*p=s-1;f(x,y){x--?*++p=48,y>x||f(x,y),++*p,y&&f(x,y-1),p--:puts(s);}main(x){scanf("%d",&x);f(x,x+x%3-4);}