#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;

typedef double Real;

Real EPS = 1e-8;

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }
  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}

  Point operator + (Point p){return Point(add(x,p.x), add(y,p.y));}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
  Point operator * (Real d){return Point(x*d,y*d);}
  Point operator / (Real d){return Point(x/d,y/d);}
  Real norm(){return sqr(x*x+y*y);}
  Real dist(Point a){return (*this-a).norm();}
  Real dot(Point a){return x*a.x+y*a.y;}
  Real cross(Point a){return x*a.y-y*a.x;}
};

struct circle{
  Point p;
  Real r;
  circle(){}
  circle(Point p, Real r) : p(p) , r(r){}
};

circle circumscribedCircle(Point p, Point q, Point r){
  Point a,b,c;
  a=(q-p)*2,b=(r-p)*2;
  c.x=p.dot(p)-q.dot(q);  
  c.y=p.dot(p)-r.dot(r);
  circle res;
  res.p.x=a.y*c.y-b.y*c.x;
  res.p.y=b.x*c.x-a.x*c.y;
  res.p=res.p/a.cross(b);
  return circle(res.p, p.dist(res.p));
}

int main(void){
  int n;
  cin >> n;
  while(n--){
    vector<Point>v(3);
    for(int i=0;i<3;i++)
      cin >> v[i].x >> v[i].y;

    circle res=circumscribedCircle(v[0],v[1],v[2]);
    printf("%.3f %.3f %.3f",res.p.x,res.p.y,res.r);
    cout << endl;
  }
  
  return 0;
}