#include<stdio.h>

int map[10][10];
int x,y,N=10;

int main(){
  while(scanf("%d",&N)*N){
  for(x=0;x<10;x++){
    for(y=0;y<10;y++){
      map[x][y]=x?map[x-1][y+1]+1:y?map[x][y-1]+y:1;
    }
  }
  for(x=0;x<N;x++){
    printf("\n");
    for(y=0;y<N;y++){
      if(x+y<N){
        if((x+y)%2){
          printf("%2d ",map[x][y]);
        }
        else{
          printf("%2d ",map[y][x]);
        }
      }
      else{
        if((x+y)%2){
          printf("%2d ",N*N-map[N-1-x][N-1-y]+1);
        }
        else{
          printf("%2d ",N*N-map[N-1-y][N-1-x]+1);
        }
      }
        
    }
  }
}

}