#include <iostream>
#include <cmath>
#include <iomanip>

#define ROUND_RANK 4
#define EPS 1e-8

using namespace std;

struct vec2
{
	double x;
	double y;
};

//行列式の算出
double Calc_det(const double& p11, const double& p12, const double& p21, const double& p22) {
	return (p11*p22 - p12*p21);
}
//xの解の算出
double Calc_x(const double& det, const double& q1, const double& p22, const double& p12, const double& q2) {
	return ((q1*p22 - p12*q2) / det);
}
//yの解の算出
double Calc_y(const double& det, const double& p11, const double& q2, const double& q1, const double& p21) {
	return ((p11*q2 - q1*p21) / det);
}
//rの解の算出
double Calc_r(const double& x0, const double& y0, const double& x1, const double& y1) {
	double r;
	r = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
	return r;
}
//少数点以下第rank位で四捨五入
double Round(const double& value, const int& rank) {
	int root = pow(10, rank);
	return (std::round(value*root) / root);
}

int main() {
	int n;
	vec2 ver[20][3];
	double p11, p12, p21, p22, q1, q2;
	double  det;//行列式
	double	x, y, r;//解

	cin >> n;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> ver[i][j].x;
			cin >> ver[i][j].y;
		}
		p11 = -2 * (ver[i][0].x - ver[i][1].x);
		p12 = -2 * (ver[i][0].y - ver[i][1].y);
		p21 = -2 * (ver[i][1].x - ver[i][2].x);
		p22 = -2 * (ver[i][1].y - ver[i][2].y);
		q1 = (ver[i][1].x + ver[i][0].x)*(ver[i][1].x - ver[i][0].x)
			+ (ver[i][1].y + ver[i][0].y)*(ver[i][1].y - ver[i][0].y);
		q2 = (ver[i][2].x + ver[i][1].x)*(ver[i][2].x - ver[i][1].x)
			+ (ver[i][2].y + ver[i][1].y)*(ver[i][2].y - ver[i][1].y);
		det = Calc_det(p11, p12, p21, p22);
		det = fabs(det);
		x = Calc_x(det, q1, p22, p12, q2);
		y = Calc_y(det, p11, q2, q1, p21);
		r = Calc_r(x, y, ver[i][0].x, ver[i][0].y);
		x = Round(x, ROUND_RANK);
		y = Round(y, ROUND_RANK);
		r = Round(r, ROUND_RANK);
		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x + EPS << " " << y + EPS << " " << r + EPS << endl;
	}
}
