#include <cmath>
#include <iostream>
using namespace std;
int main(){
int n, m, in;
int c = 1;
while(cin >> n){
if(n== 0) break;
int nums[n];
for(int i = 0; i < n; i++){
cin >> in;
nums[i] = in;
}
cin >> m;
int queries[m];
for(int i = 0; i < m; i++){
cin >> in;
queries[i] = in;
}
// sort(nums, nums + n, greater<int>());
sort(nums, nums + n);
cout << "Case " << c << ":" << endl;
c++;
}
return 0;
}