include[HTML_REMOVED]
using namespace std;
int main(){
int n[100],i,d,f,a,m;
for( m=0;m<100;m){
cin>>n[m];if(n[m]==0) break;}
for(int c=0;c<=m;c){
for(i=1;i<=n[c];i++){if(i>=1)
for(f=i;1<=f;f--)
cout<<f<<' ';
for(f=2;f<=n[c]-i+1;f++)
cout<<f<<' ';cout<<endl;
}if(n[c+1]!=0)cout<<endl;}
return 0;
}