#include<iostream>
#include<cmath>
using namespace std;
void caculate(double x,double y,double z,double x1,double y1,double z1)
{
double x_len,y_len,z_len;
x_len = x1 - x;
y_len = y1 - y;
z_len = z1 - z;
double r = sqrt(x_len * x_len + y_len * y_len + z_len * z_len);
double v = 3.1415926 * pow(r, 3) * 4 / 3;
printf("%.2lf %.2lf",r,v);
cout << endl;
}
int main(void)
{
int m;
while(cin >> m)
{
while(m--)
{
double x,y,z;
cin >> x >> y >> z;
double x1,y1,z1;
cin >> x1 >> y1 >> z1;
caculate(x, y, z, x1, y1, z1);
}
}
return 0;
}