> File Name: 3671.cpp
> Author: jiangyuzhu
> Mail: 834138558@qq.com
> Created Time: 2016/9/13 23:14:54
************************************************************************/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
const int maxn = 1e3 + 5, maxm = 1e4 + 5;
int dfnum;
int low[maxn], dfn[maxn];
struct EDGE{
int to, next;
bool flag;
}edge[maxm << 1];
int head[maxn];
int tot;
int cnt;
bool vis[maxn];
void init()
{
memset(vis, 0, sizeof(vis));
memset(low, 0, sizeof(low));
memset(dfn, 0, sizeof(dfn));
dfnum = 1;
cnt = 0;
}
void addedge(int from, int to)
{
edge[tot].to = to;
edge[tot].next = head[from];
head[from] = tot++;
}
int num;
void dfs(int u, int pa, int k)
{
int child = 0;
dfn[u] = low[u] = dfnum++;
num++;
for(int i = head[u]; i != -1; i = edge[i].next){
int v = edge[i].to;
if(v == k || v == pa) continue;
if(!dfn[v]){
child++;
dfs(v, u, k);
low[u] = min(low[u], low[v]);
if(pa == -1 && child > 1){
if(!vis[u]) cnt++;
vis[u] = true;
}
if(pa != -1 && low[v] >= dfn[u]){
if(!vis[u]) cnt++;
vis[u] = true;
}
}else{
low[u] = min(low[u], dfn[v]);
}
}
}
int main (void)
{
int n, m;
int kas = 1;
while(~scanf("%d%d", &n, &m) && (n + m)){
int u, v;
memset(head, -1, sizeof(head));
tot = 0;
for(int i = 0; i < m; ++i){
scanf("%d%d", &u, &v);
addedge(u, v);
addedge(v, u);
}
int ans = 0;
for(int i = 1; i <= n; ++i){
init();
int cntt = 0, t = 0;
for(int j = 1; j <= n; j++){
if(j == i || dfn[j]) continue;
cntt++;
num = 0;
dfs(j, -1, i);
if(num == 1) t++;
}
if(cntt == 1) ans += cnt;
else if(cntt == 2 && t == 1) ans += n - 2;
else if(cntt == 2 && t == 0) ans += n - 1;
else if(cntt > 2) ans += n - 1;
}
printf("Case %d: %d\n", kas++, ans / 2);
}
return 0;
}