#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<queue>
#include<cstring>
#include<vector>
#include<stack>
#include<map>
#include<set>
#define MAX 1000005
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
int x1,x2,y11,y2,u1,u2,v1,v2;
int main(){
int t;
scanf("%d",&t);
int id=1;
while(t--){
scanf("%d %d %d %d",&x1,&y11,&x2,&y2);
scanf("%d %d %d %d",&u1,&v1,&u2,&v2);
double a=x2-x1,b=u2-u1,c=y2-y11,d=v2-v1;
double aa=b*b+d*d,bb=2*(a*b+c*d),cc=a*a+c*c;
double ans=0.0;
if(aa==0){
if(bb>=0) ans=sqrt(cc);
else ans=0;
}else{
if(bb<0) ans=sqrt((4*aa*cc-bb*bb)/(4*aa));
else ans=sqrt(cc);
}
printf("Case %d: %.6lf\n",id++,ans);
}
return 0;
}