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

double area(const complex<double> &p0, const complex<double> &p1, const complex<double> &p2) {
    complex<double> _p0 (p0.real() - p1.real(), p0.imag() - p1.imag());
    complex<double> _p1 (p1.real() - p2.real(), p1.imag() - p2.imag());

    double a = (_p0.real() * _p1.imag() - _p0.imag() * _p1.real()) * 0.5;
    return (a > 0) ? a : -a;
}

double dist2(const complex<double> &p0, const complex<double> &p1) {
    return (p0.real() - p1.real()) * (p0.real() - p1.real())
        + (p0.imag() - p1.imag()) * (p0.imag() - p1.imag());
}

int main () {
    int n;
    cin >> n;
    while (n--) {
        complex<double> p[3];
        for (int i = 0; i < 3; i++) {
            double x, y;
            cin >> x >> y;
            p[i] = complex<double> (x, y);
        }

        double d2[3], d[3];
        for (int i = 0; i < 3; i++) {
            d2[i] = dist2(p[(i+1)%3], p[(i+2)%3]);
            d[i] = sqrt(d2[i]);
        }

        double s = area(p[0], p[1], p[2]);
        double ss = s * s * 16;

        double e[3];
        e[0] = d2[0] * (-d2[0] + d2[1] + d2[2]) / ss;
        e[1] = d2[1] * (d2[0] - d2[1] + d2[2]) / ss;
        e[2] = d2[2] * (d2[0] + d2[1] - d2[2]) / ss;

        double x = 0, y = 0;
        for (int i = 0; i < 3; i++) {
            x += e[i] * p[i].real();
            y += e[i] * p[i].imag();
        }
        double r = d[0] * d[1] * d[2] /
            sqrt((d[0]+d[1]+d[2]) * (-d[0]+d[1]+d[2]) * (d[0]-d[1]+d[2]) * (d[0]+d[1]-d[2]));

        printf("%.3f %.3f %.3f\n", x, y, r);
    }
}