#include"iostream"
#include"cstdio"
#include"cmath"

using namespace std;

int main()
{
	int n;
	double x1, y1, x2, y2, x3, y3;
	double x, y, r;

	cin >> n;
	while (n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double t1 = x1*x1 + y1*y1;
		double t2 = x2*x2 + y2*y2;
		double t3 = x3*x3 + y3*y3;
		double temp = x1*y2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 - x3*y2;
		double x = (t2*y3 + t1*y2 + t3*y1 - t2*y1 - t3*y2 - t1*y3) / temp / 2;
		double y = (t3*x2 + t2*x1 + t1*x3 - t1*x2 - t2*x3 - t3*x1) / temp / 2;
		r = sqrt((x1 - x)*(x1 - x) + (y1 - y)*(y1 - y));
		printf("%.3lf %.3lf %.3lf", x, y, r);
	}
	return 0;
}