#include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
#define x1 0
#define y1 1
#define x2 2
#define y2 3
#define x3 4
#define y3 5

int main()
{
	int n;
	double inp,a,b,c,d,e,f,x,y,r;
	vector<double> xy;

	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<6;j++)
		{
			cin>>inp;
			xy.push_back(inp);
		}
		a=2*(xy[x2]-xy[x1]);
		b=2*(xy[y2]-xy[y1]);
		c=2*(xy[x3]-xy[x2]);
		d=2*(xy[y3]-xy[y2]);
		e=xy[y2]*xy[y2]-xy[y1]*xy[y1]+xy[x2]*xy[x2]-xy[x1]*xy[x1];
		f=xy[y3]*xy[y3]-xy[y2]*xy[y2]+xy[x3]*xy[x3]-xy[x2]*xy[x2];

		x=(d*e-b*f)/(a*d-b*c);
		y=(a*f-c*e)/(a*d-b*c);
		r=sqrt(pow(xy[x1]-x,2)+pow(xy[y1]-y,2));

		x+=0.0005;
		y+=0.0005;
		y+=0.0005;

		printf("%.3lf %.3lf %.3lf",x,y,r);
	}
}