#include <iostream>
#include <cmath>

using namespace std;

#define reep(i, a, n) for(int i = a;i < n; i++)
#define rep(i, n) reep(i, 0, n)

double pow2(double in){
    return in * in;
}

double distance(double x1, double y1, double x2, double y2){
    return sqrt(pow2(y2 - y1) + pow2(x2 - x1));
}

int main(){
    
    int n;
    double x[3], y[3], a, b, cx, cy, r, X[2], Y[2], al, be, cal, ca, sa;
    
    scanf("%d", &n);
    
    rep(i, n){
        
        rep(j, 3){
            scanf("%lf %lf", &x[j], &y[j]);
        }
        
        ca = (pow2(distance(x[0], y[0], x[1], y[1])) 
ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　+ pow2(distance(x[1], y[1], x[2], y[2])) 
ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　- pow2(distance(x[2], y[2], x[0], y[0])))
ツ　ツ　ツ　ツ　ツ　 / (2.0 * distance(x[0], y[0], x[1], y[1]) * distance(x[1], y[1], x[2], y[2]));
        
        sa = sqrt(1.0 - pow2(ca));
        
        r = distance(x[2], y[2], x[0], y[0]) / sa;
        
        r /= 2.0;
        
        X[0] = x[1] - x[0];
        X[1] = x[2] - x[0];
        Y[0] = y[1] - y[0];
        Y[1] = y[2] - y[0];
        
        al = -(pow2(x[0]) - pow2(x[1]) + pow2(y[0]) - pow2(y[1]));
        be = -(pow2(x[0]) - pow2(x[2]) + pow2(y[0]) - pow2(y[2]));
        
        cal = (X[0] * Y[1] - X[1] * Y[0]) * 2.0;
        
        cx = (Y[1] * al - Y[0] * be) / cal;
        cy = (X[0] * be - X[1] * al) / cal;
        
        printf("%.3lf %.3lf %.3lf\n", cx, cy, r);
        
    }
    
    return 0;
}