#include <iostream>
#include <cstdio>
#include <cmath>

void gradcut(double *a,double *b,double x1,double y1,double x2,double y2);
double fixzero(double z){
    if (z==-0) return 0;
    else return z;
}
int main() {
    double x[3],y[3],a[2],b[2],rx,ry,r;
    int n;
    std::cin >> n;
    for(int j=0;j<n;j++){
        int am=0,add=1;;
        for(int i=0;i<3;i++) std::cin >> x[i] >> y[i];
        for(int i=0;i<3;i++){
            if(i==2) add=-2;
            if(x[i]!=x[i+add]&&y[i]!=y[i+add]){
                gradcut(&a[am],&b[am],x[i],x[i+add],y[i],y[i+add]);
                am++;
                if(am>2) break;
            }else if(x[i]==x[i+add]){
                a[am]=0;
                b[am]=(y[i]+y[i+add])/2;
                am++;
                if(am>2) break;
            }
        }


        rx = (b[1]-b[0])/(a[0]-a[1]);
        ry = a[0]*rx+b[0];
        r=sqrt((x[0]-rx)*(x[0]-rx)+(y[0]-ry)*(y[0]-ry));
        printf("%.3f %.3f %.3f\n",fixzero(rx),fixzero(ry),fixzero(r));
    }
    return 0;
}

void gradcut(double *a,double *b,double x1,double x2,double y1,double y2){
    *a=-(x2-x1)/(y2-y1);
    *b=(y1+y2)/2-(*a)*(x1+x2)/2;
}