#include <cmath>
#include <cstdio>

using namespace std;

inline double sq(double x) {
  return x * x;
}

inline double det(double a, double b, double c, double d) {
  return a * d - b * c;
}

int main() {
  int N;
  scanf("%d", &N);
  for (int I = 0; I < N; I++) {
    double x[3], y[3];
    for (int i = 0; i < 3; i++)
      scanf("%lf%lf", x+i, y+i);
    double a = 2*(x[1]-x[0]),
           b = 2*(y[1]-y[0]),
           c = 2*(x[2]-x[0]),
           d = 2*(y[2]-y[0]),
           e = sq(x[1])-sq(x[0])+sq(y[1])-sq(y[0]),
           f = sq(x[2])-sq(x[0])+sq(y[2])-sq(y[0]),
           p = det(e, b, f, d) / det(a, b, c, d),
           q = det(a, e, c, f) / det(a, b, c, d),
           r = sqrt(sq(p-x[0])+sq(q-y[0]));
    p = round(p * 1000.0) / 1000.0;
    q = round(q * 1000.0) / 1000.0;
    r = round(r * 1000.0) / 1000.0;
    printf("%.3f %.3f %.3f\n", p, q, r);
  }
  return 0;
}