#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	double x1, y1, x2, y2, x3, y3, r, xa, ya, xb, yb, xc, yc;
	double x, y;
	int n;

	cin >> n;
	
	for (int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		xa = (x2 - x1) * 2;
		xb = (y2 - y1) * 2;
		xc = pow(x1, 2) - pow(x2, 2) + pow(y1, 2) - pow(y2, 2);
		ya = (x3 - x1) * 2;
		yb = (y3 - y1) * 2;
		yc = pow(x1, 2) - pow(x3, 2) + pow(y1, 2) - pow(y3, 2);
		x = (xb * yc - yb * xc) / (xa * yb - ya * xb);
		y = (xc * ya - yc * xa) / (xa * yb - ya * xb);
		r = hypot(x - x1, y - y1);
		printf("%.3lf %.3lf %.3lf", x, y, r);
	}
	return (0);
}