水数学
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<map>
#define PI acos(-1.0)
#define in freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 1000 + 7, maxd = 670000 + 7, mod = 1e9 + 7;
const int INF = 0x7f7f7f7f;
struct node {
int n, m;
}a[maxn];
bool cmp(node a, node b) {
return ( a.m < b.m || (a.m == b.m && a.n > b.n) );
}
void init() {
for(int i = 1; i <= 1000; ++i) {
a[i].n = i;
a[i].m = 1;
}
for(int i = 2; i <= 1000; ++i) {
for(int j = i; j <= 1000; j += i) {
a[j].m++;
}
}
sort(a+1, a+1+1000, cmp);
}
int main() {
init();
int T;
scanf("%d", &T);
for(int tt = 1; tt <= T; ++tt) {
int x; scanf("%d", &x);
printf("Case %d: %d\n", tt, a[x].n);
}
return 0;
}