#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
  double x1,x2,x3,y1,y2,y3;
  int n;
  while(cin >> n){
    for(int i = 0 ; i < n ; i++){
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; 
      double a = 2*(x2 - x1),b = 2*(y2 - y1),c = x1*x1 - x2*x2 + y1*y1 - y2*y2;
      double a2 = 2*(x3 - x1),b2 = 2*(y3 - y1),c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
      double x = (b*c2 - b2*c)/(a*b2 - a2*b);
      double y = (c*a2 - c2*a)/(a*b2 - a2*b);
      double r = sqrt(pow(x-x1,2) + pow(y-y1,2));

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