#include <cassert>
#include <cmath>
#include <cstdio>

int main() {
  int n = 0;
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    float x1, y1, x2, y2, x3, y3;
    scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);

    // x^2 + y^2 + lx + my + n = 0

    float A[3][3] = { {x1, y1, 1}, {x2, y2, 1}, {x3, y3, 1} };
    // detA = a00a11a22 + a10a21a02 + a20a01a12 - a00a21a12 - a20a11a02 - a10a01a22
    float detA =
        A[0][0] * A[1][1] * A[2][2]
      + A[1][0] * A[2][1] * A[0][2]
      + A[2][0] * A[0][1] * A[1][2]
      - A[0][0] * A[2][1] * A[1][2]
      - A[2][0] * A[1][1] * A[0][2]
      - A[1][0] * A[0][1] * A[2][2];

    assert(detA != 0);
    float invA[3][3] = {
        { (A[1][1] * A[2][2] - A[1][2] * A[2][1]) / detA,
          (A[0][2] * A[2][1] - A[0][1] * A[2][2]) / detA,
          (A[0][1] * A[1][2] - A[0][2] * A[1][1]) / detA },
        { (A[1][2] * A[2][0] - A[1][0] * A[2][2]) / detA,
          (A[0][0] * A[2][2] - A[0][2] * A[2][0]) / detA,
          (A[0][2] * A[1][0] - A[0][0] * A[1][2]) / detA },
        { (A[1][0] * A[2][1] - A[1][1] * A[2][0]) / detA,
          (A[0][1] * A[2][0] - A[0][0] * A[2][1]) / detA,
          (A[0][0] * A[1][1] - A[0][1] * A[1][0]) / detA }
    }; 

    float b[3] = {-(x1 * x1 + y1 * y1), -(x2 * x2 + y2 * y2), -(x3 * x3 + y3 * y3)};
    
    float l = invA[0][0] * b[0] + invA[0][1] * b[1] + invA[0][2] * b[2];
    float m = invA[1][0] * b[0] + invA[1][1] * b[1] + invA[1][2] * b[2];
    float n = invA[2][0] * b[0] + invA[2][1] * b[1] + invA[2][2] * b[2];
      
    // (x + l/2)^2 - l^2/4 + (y + m/2)^2 - m^2/4 + n = 0;
    // (x, y) = (-l/2, -m/2)
    // r = sqrt(l^2/4 + m^2/4 - n)
    float px = -l / 2;
    float py = -m / 2;
    float r = std::sqrt(l * l / 4.0 + m * m / 4.0 - n);
    
    printf("%.3f %.3f %.3f\n", px, py, r);
  }
}