#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <iomanip>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define SQ(i) ((i) * (i))
using namespace std;

int main(){
  double x1, y1, x2, y2, x3, y3;
  double a1, b1, c1, a2, b2, c2, x, y, a, b, c, cos_a, sin_a, r;
  int n;
  scanf("%d", &n);
  while(n--){
    scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
    a1 = 2 * (x2 - x1); a2 = 2 * (x3 - x1);
    b1 = 2 * (y2 - y1); b2 = 2 * (y3 - y1);
    c1 = SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2);
    c2 = SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3);
    x = (b1 * c1 - b2 * c1) / (a1 * b2 - a2 * b1);
    y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    r = SQ(x3-x) + SQ(y3 - y);
    r = sqrt(r);
    printf("%.3f %.3f %.3f\n",x, y, r);
  }
  return 0;
}