#include<stdio.h>
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
	int n; cin >> n;
	double x[3];
	double y[3];
	double r;

	while(n--){
	 for(int j=0;j<3;j++){
	 	cin >> x[j] >> y[j];
	 }

	 double a = 2*(x[1]-x[0]);
	 double b = 2*(y[1]-y[0]);
	 double c = 2*(x[2]-x[0]);
	 double d = 2*(y[2]-y[0]);

	 double e = pow(x[1],2.0)-pow(x[0],2.0)+pow(y[1],2.0)-pow(y[0],2.0);
	 double f = pow(x[2],2.0)-pow(x[0],2.0)+pow(y[2],2.0)-pow(y[0],2.0);

	 if(a==0){
	 	swap(a,c);
	 	swap(b,d);
	 	swap(e,f);
	 }

	b = b/a;
	e = e/a;
	a = a/a;
	 
	 
	d = d-b*c;
	f = f-e*c;
	c = c-a*c;

	f = f/d;
	d = d/d;

	b = b-d*b;
	e = e-f*b;

	r = sqrt(pow((e-x[0]),2.0)+pow((f-y[0]),2.0));
	
	cout << fixed;
	cout << setprecision(3) << e <<" "<< f << " " << r << endl;
	}
	return 0;

}
