#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
	int a,b,c,d,e,f,g;
	double A,B,C,D,E,F,G,H,I,L,M,N,O,P,Q,R,J,K,X,Y;
	scanf("%d",&a);
	
	for(b=0;b<a;b++){
		scanf("%lf %lf %lf %lf %lf %lf",&A,&B,&C,&D,&E,&F);
		G=-2.0*A*D+2.0*C*D+2.0*A*F-2.0*C*F+2.0*B*C-2.0*B*E-2.0*C*D+2.0*E*D;
		H=D-F;
		I=B+D;
		J=B-D;
		K=B-D;
		L=D+F;
		M=D-F;
		O=-H*I*J+K*L*M-A*A*D+A*D*C+A*A*F-A*C*F-A*C*D+C*C*D+A*C*F-C*C*F+B*C*C-B*C*E-C*C*D+E*C*D+B*C*E-B*E*E-C*E*D+E*E*D;
		X=O/G;
		if(G==0.0)X=0.0;
		//if(O==0.0)X=0.0;
		
		H=-2*F+2*D;
		I=C-X;
		I=I*I;
		J=E-X;
		J=J*J;
		I=I-J;
		I=I+D*D-F*F;
		Y=I/H;
		//if(H==0.0)Y=0.0;
		
		H=X-A;
		I=Y-B;
		H=H*H;
		I=I*I;
		H=H+I;
		R=sqrt(H);
		
		
		
		
		
	}
	printf("%.3lf %.3lf %.3lf\n",X,Y,R);
	return 0;
}