#include using namespace std; int n,m; struct Edge { int a,b,w; char c[5]; bool operator <(const Edge&tmp)const { return w1)res1=1e9; //B G int res2=0,flag2=0; for(int i=1; i<=n; i++)par[i]=i; for(int i=1; i<=m; i++) { if(way[i].c[0]=='R')continue; int x=find(way[i].a),y=find(way[i].b); if(x==y)continue; mark[1][i]=1; par[x]=y; res2+=way[i].w; } for(int i=1; i<=n; i++)if(par[i]==i)flag2++; if(flag2>1)res2=1e9; printf("Case #%d:\n",++cas); for(int k=1; k