import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int m = in.nextInt();
while (m-- > 0) {
double x0 = in.nextDouble();
double y0 = in.nextDouble();
double z0 = in.nextDouble();
double x1 = in.nextDouble();
double y1 = in.nextDouble();
double z1 = in.nextDouble();
double r = Math.sqrt
(Math.pow(x1 - x0, 2) +
Math.pow(y1 - y0, 2) +
Math.pow(z1 - z0, 2));
double v = 4.0 / 3 * Math.PI * Math.pow(r,3);
System.out.printf("%.2f %.2f%n",r,v);
}
}
}