#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  int cnt=0;
  while(cin>>n,n){
    cnt++;
    cout<<"Case "<<cnt<<":"<<endl;
    vector<vector<int> >in(n*2-1,vector<int>(n*2-1));
    int c=2;
    int x,y;
    in[0][0]=1;
    loop(i,1,n){
      x=0;y=i*2-1;
      while(1){
	if(x>=0&&x<n&&y>=0&&y<n){
	  in[x][y]=c;
	  c++;
	}
	x++;y--;
	if(y==-1)break;
      }
      x=i*2;y=0;
      while(1){
	if(x>=0&&x<n&&y>=0&&y<n){
	  in[x][y]=c;
	  c++;
	}
	x--;y++;
	if(x==-1)break;
      }	
    }
    rep(i,n){
      rep(j,n)
	printf("%3d",in[i][j]);
      cout<<endl;
    }
  }
}