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

using namespace std;

int main() {
	int c;
	double x1, y1, x2, y2, x3, y3;
	double px, py, r;
	double e1, e2, e3;
	double l, m, n;

	cout << fixed << setprecision(3);
	cin >> c;
	for (int i = 0; i < c; ++i) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		e1 = - pow(x1, 2) - pow(y1, 2);
		e2 = - pow(x2, 2) - pow(y2, 2);
		e3 = - pow(x3, 2) - pow(y3, 2);

		l = (e1 * y2+ e2 * y3+ e3 * y1- e1 * y3- e2 * y1- e3 * y2)/ (x1 * y2+ x2 * y3+ x3 * y1- x1 * y3- x2 * y1- x3 * y2);
		m = (x1 * e2+ x2 * e3+ x3 * e1- x1 * e3- x2 * e1- x3 * e2)/ (x1 * y2+ x2 * y3+ x3 * y1- x1 * y3- x2 * y1- x3 * y2);
		n = (x1 * y2 * e3 + x2 * y3 * e1 - x3 * y1 * e2 - x1 * y3 * e2 - x2 * y1 * e3 - x3 * y2 * e1)/ (x1 * y2+ x2 * y3+ x3 * y1- x1 * y3- x2 * y1- x3 * y2);

		px = - l / 2;
		py = - m / 2;
		r = sqrt(pow(px, 2) + pow(py, 2) - n);

		cout << px << " " << py << " " << r << endl;
	}

	return 0;
}