include[HTML_REMOVED]
using namespace std;
int n,num,dir;
int main(){
while(1){
cin>>n;
if(n==0)break;
for(int i=1;i<=n;i){
num=i;
dir=-1;
for(int j=1;j<n;j){
cout<<num<<” “;
if(num==1){
dir=-dir;
}
num=num+dir;
}
cout<<num<<endl;
}
cout<<endl;
}
}