//一篇用递归解决的
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
void str(int n,vector[HTML_REMOVED]>&arr,int x,int y);
int main(){
int n;
while(cin>>n){
if(n==0){
break;
}
vector[HTML_REMOVED]> arr(n,vector[HTML_REMOVED](n));
int x=0,y=0;
str(n,arr,x,y);
for(int i=0;i[HTML_REMOVED]>&arr,int x,int y){
if(n<=0){
return ;
}
int count=1;
for(int i=0;i<n;i){
arr[x][y+i]=count;//x,y用于更新起始坐标
arr[x+i][y]=count;
count;
}
str(n-1,arr,x+1,y+1);
}