/*
NOTE :
*min_element(.begin(),.end())
*max_element(.begin(),.end())
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define MAX 100
#define INF 1<<20
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;
/////
template <class T>
void printMartix(valarray<valarray<T> > &A)
{
  int n = A.size();
  int m = A[0].size();
  REP(i,n){{REP(j,n) cout << A[i][j] << " ";} cout << endl;}
  cout << endl;
}

template <class T>
void printArray(valarray<T> &A)
{
  int n = A.size();
  REP(i,n) cout << A[i] << " ";
  cout << endl << endl;
}

template <class T>
bool solution(valarray<valarray<T> > &A, valarray<T> &b)
{
  int n = A.size();
  REP(i,n)
  {
    T a;
    //printMartix(A);
    //printArray(b);
    REP2(u,i,n)
    {
      a = A[u][i];
      if(a == 0) continue;
      else
      {
        if(u != i)
        {
          swap(A[i],A[u]);
          swap(b[i],b[u]);
        }
        break;
      }
      if(u == n-1) return false;
    }
    A[i] /= (1.0 * a);
    b[i] /= (1.0 * a);
    REP(j,n)
    {
      if(j == i) continue;
      b[j] -= b[i] * A[j][i];
      A[j] -= A[i] * A[j][i];
    }
    //printMartix(A);
    //printArray(b);
  }
  return true;
}

/////
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int n; cin >> n;
  REP(u,n)
  {
    double x[3], y[3]; REP(i,3) cin >> x[i] >> y[i];
    valarray<valarray<double> > A(valarray<double>(0.0,3),3);
    valarray<double> b(0.0,3);
    REP(i,3)
    {
      A[i][0] = x[i];
      A[i][1] = y[i];
      A[i][2] = 1;
      b[i] = -(x[i]*x[i] + y[i]*y[i]);
    }
    if(solution(A,b))
    {
      double cx = -b[0] * 0.5;
      double cy = -b[1] * 0.5;
      double r = sqrt((x[0]-cx)*(x[0]-cx)+(y[0]-cy)*(y[0]-cy));
      printf("%.3lf %.3lf %.3lf\n",cx,cy,r);
    }
    //else cout << "no solution" << endl;
  }
  return 0;
}