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

using namespace std;

void calcInverseMatrix(double A[][3], double invA[][3]);

int main(void)
{
	int n = 0;
	cin >> n;
	
	for(int i = 0; i < n; i++){
		double x1 = 0.0, y1 = 0.0;
		double x2 = 0.0, y2 = 0.0;
		double x3 = 0.0, y3 = 0.0;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		
		double A[3][3] = {0};
		double invA[3][3] = {0};
		
		A[0][0] = x1;
		A[0][1] = y1;
		A[0][2] = 1.0;
		A[1][0] = x2;
		A[1][1] = y2;
		A[1][2] = 1.0;
		A[2][0] = x3;
		A[2][1] = y3;
		A[2][2] = 1.0;
		
		calcInverseMatrix(A, invA);
		
		double B[3] = {0};
		B[0] = - x1 * x1 - y1 * y1;
		B[1] = - x2 * x2 - y2 * y2;
		B[2] = - x3 * x3 - y3 * y3;
		
		double C[3] = {0};
		for(int i = 0; i < 3; i++){
			C[i] = invA[i][0]*B[0] + invA[i][1]*B[1] + invA[i][2]*B[2];
		}
		
		double centX = - C[0] / 2.0;
		double centY = - C[1] / 2.0;
		double radius = sqrt(centX * centX + centY * centY - C[2] * C[2]);
		cout << showpoint << setprecision(4) << centX << " " << centY << " " << radius << endl;
	}
	
	return 0;
}

void calcInverseMatrix(double A[][3], double invA[][3])
{
	double det = A[0][0]*A[1][1]*A[2][2] + A[1][0]*A[2][1]*A[0][2] +
				 A[2][0]*A[0][1]*A[1][2] - A[0][0]*A[2][1]*A[1][2] -
				 A[2][0]*A[1][1]*A[0][2] - A[1][0]*A[0][1]*A[2][2];
	
	invA[0][0] = (A[1][1]*A[2][2] - A[1][2]*A[2][1]) / det;
	invA[0][1] = (A[0][2]*A[2][1] - A[0][1]*A[2][2]) / det;
	invA[0][2] = (A[0][1]*A[1][2] - A[0][2]*A[1][1]) / det;
	invA[1][0] = (A[1][2]*A[2][0] - A[1][0]*A[2][2]) / det;
	invA[1][1] = (A[0][0]*A[2][2] - A[0][2]*A[2][0]) / det;
	invA[1][2] = (A[0][2]*A[1][0] - A[0][0]*A[1][2]) / det;
	invA[2][0] = (A[1][0]*A[2][1] - A[1][1]*A[2][0]) / det;
	invA[2][1] = (A[0][1]*A[2][0] - A[0][0]*A[2][1]) / det;
	invA[2][2] = (A[0][0]*A[1][1] - A[0][1]*A[1][0]) / det;
}