#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
	double A1, B1, C1, A2, B2, C2;
	double X1, X2, X3, Y1, Y2, Y3;
	double X, Y, R;

	int n;
	cin>>n;

	for(int i = 0; i < n; i++){
		cin>>X1>>Y1>>X2>>Y2>>X3>>Y3;

		A1=2*(X2-X1);
		B1=2*(Y2-Y1);
		C1=pow(X1,2)-pow(X2,2)+pow(Y1,2)-pow(Y2,2);
		A2=2*(X3-X1);
		B2=2*(Y3-Y1);
		C2=pow(X1,2)-pow(X3,2)+pow(Y1,2)-pow(Y3,2);

		X = (B1*C2-B2*C1)/(A1*B2-A2*B1);
		Y = (C1*A2-C2*A1)/(A1*B2-A2*B1);

		R = sqrt(pow(max(X,X1)-min(X,X1),2)+pow(max(Y,Y1)-min(Y,Y1),2));

		if(X >= 0) X = ((double)((int)(X*1000+0.5)))/1000;
		else X = ((double)((int)(X*1000-0.5)))/1000;
		if(Y >= 0) Y = ((double)((int)(Y*1000+0.5)))/1000;
		else Y = ((double)((int)(Y*1000-0.5)))/1000;
		if(R >= 0) R = ((double)((int)(R*1000+0.5)))/1000;
		else R = ((double)((int)(R*1000-0.5)))/1000;

		printf("%.3f %.3f %.3f",X, Y, R);
	}
}