#include <stdio.h>
#define MAX 9

void set(int map[MAX][MAX], int i, int j, int n, int *counter){
	if(i >= n || j >= n){return;}
	map[i][j] = *counter;
	(*counter)++;
}

int main(void){
	int map[MAX][MAX];
	int i,j,l,n,counter;
	int caseNum = 1;
	while(scanf("%d",&n) != EOF){
		if(n == 0){break;}
		counter = 1;
		for(l = 0; l < 2 * n; l++){
			if(l % 2 == 0){
				i = l;
				j = 0;
				while(1){
					set(map,i,j,n,&counter);
					if(i == 0 || i == j && i == n-1){
						break;
					}
					i--;
					j++;
				}

			}else{
				i = 0;
				j = l;
				while(1){
					set(map,i,j,n,&counter);
					if(j == 0 || i == j && i == n-1){
						break;
					}
					i++;
					j--;
				}
			}
		}
		printf("Case %d:\n",caseNum);
		for(i = 0; i < n; i++){
			for(j = 0; j < n; j++){
				printf("%3d",map[i][j]);
			}
			putchar('\n');
		}
		caseNum++;
	}
	return 0;
}