#include<bits/stdc++.h>
#define pi 3.1415926
using namespace std;
using ll = long long;
int t;
int x_0,x_1,y_0,y_1,z_0,z_1;
double r,v;
double pf(double x){
return x*x;
}
double lf(double x){
return x*x*x;
}
void solve(){
cin>>t;
while(t--){
cin>>x_0>>y_0>>z_0>>x_1>>y_1>>z_1;
r = pow(pf(abs(x_0-x_1)) + pf(abs(y_0-y_1)) + pf(abs(z_0-z_1)),1.0/2);
v = 4.0/3 * pi * lf(r);
printf("%.2f %.2f\n",r,v);
}
}
int main(){
solve();
return 0;
}