c++
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1005;
std::vector<int> g[N], vbcc[N];
int dfn[N], low[N], tot;
int stk[N], top;
int vbcc_cnt;
bool cut[N];
int n, m, ans = 0;
ll s = 1;
void tarjan(int u, bool root) {
dfn[u] = low[u] = ++tot;
stk[++top] = u;
int son = 0;
for (int v : g[u]) {
if (!dfn[v]) {
++son;
tarjan(v, false);
low[u] = std::min(low[u], low[v]);
if (low[v] >= dfn[u]) {
if (!root || son >= 2) cut[u] = true;
++vbcc_cnt;
do {
vbcc[vbcc_cnt].push_back(stk[top]);
} while (stk[top--] != v);
vbcc[vbcc_cnt].push_back(u);
}
} else {
low[u] = std::min(low[u], dfn[v]);
}
}
}
void init() {
for (int i = 1; i <= std::max(n,vbcc_cnt); i++) {
vbcc[i].clear();
g[i].clear();
dfn[i] = low[i] = 0;
cut[i] = false;
}
vbcc_cnt = 0, tot = 0, top = 0;
ans = 0;
s = 1;
n=0;
}
void fc() {
for (int i = 0; i < m; i++) {
int u, v;
std::cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
n = std::max({n, u, v});
}
tarjan(1, true);
if (vbcc_cnt == 1) {
std::cout << 2 << " " << n*(n-1)/2 << "\n";
} else {
for (int i = 1; i <= vbcc_cnt; i++) {
int c = 0;
for (int v : vbcc[i]) {
if (cut[v]) c++;
}
if (c == 1) {
s *= (ll)vbcc[i].size() - 1;
ans++;
}
}
std::cout << ans << " " << s << "\n";
}
init();
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
std::cin >> m;
int k = 1;
while (m) {
std::cout << "Case " << k << ": ";
fc();
k++;
std::cin >> m;
}
return 0;
}