#include <iostream>
using namespace std;

int N;
int s[10][10];


int make(int n) {
	int c = 0;
	for (int i = 0; i < (n - 1) * 2 + 1; i++) {
		for (int j = 0; j < n; j++) {
			int p = i - j;
			if (p < n && p >= 0) {
				if (i % 2 == 0) {
					s[p][j] = ++c;
				}
				else {
					s[j][p] = ++c;
				}
			}
		}
	}
	return 0;
}

int main(){

	int c = 0;
	while (cin >> N && N != 0) {
		cout << "Case " << ++c << ":" << endl;
		make(N);
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (s[i][j] >= 100) {
					cout << s[i][j];
				}
				else if (s[i][j] >= 10) {
					cout << " " << s[i][j];
				}
				else {
					cout << "  " << s[i][j];
				}
			}
			cout << endl;
		}
	}

	return 0;
}