Go: package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n := r.nextInt()

	type Vec struct {
		x, y float64
	}
	vec := func(a, b Vec) Vec { return Vec{b.x - a.x, b.y - a.y} }
	unv := func(a Vec) Vec { return Vec{-a.y, a.x} }
	cdot := func(a, b Vec) float64 { return a.x*b.x + a.y*b.y }
	times := func(t float64, a Vec) Vec { return Vec{t * a.x, t * a.y} }
	add := func(a, b Vec) Vec { return Vec{a.x + b.x, a.y + b.y} }
	for i := 0; i < n; i++ {

		r.Scan(true)
		nextFloat64 := func() (ret float64) { fmt.Sscanf(r.nextString(), "%f", &ret); return }
		a1, a2, a3 := Vec{nextFloat64(), nextFloat64()}, Vec{nextFloat64(), nextFloat64()}, Vec{nextFloat64(), nextFloat64()}
		unv23 := unv(vec(a2, a3))
		v12 := vec(a1, a2)
		v31 := vec(a3, a1)
		s := cdot(v12, v31) / 2 / cdot(v12, unv23)
		c := add(times(.5, add(a2, a3)), times(s, unv23))
		v1c := vec(a1, c)
		fmt.Fprintf(stdout, "%.3f %.3f %.3f\n", c.x, c.y, math.Sqrt(v1c.x*v1c.x+v1c.y*v1c.y))
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;   // 許容誤差。問題によって変える
typedef complex<double> P; // Point
//点の座標は複素数で持つ
#define X real()
#define Y imag()
namespace std
{
bool operator<(const P p1, const P p2)
{
    return p1.X != p2.X ? p1.X < p2.X : p1.Y < p2.Y;
}
P operator+(const P p1, const P p2) { return P(p1.X + p2.X, p1.Y + p2.Y); }
P operator-(const P p1, const P p2) { return P(p1.X - p2.X, p1.Y - p2.Y); }
P operator*(const P p, double k) { return P(p.X * k, p.Y * k); }
P operator/(const P p, double k) { return P(p.X / k, p.Y / k); }
} // namespace std
//ここまで写経必須

//Segment/L
struct Segment
{
    P p1, p2;
    Segment() {}
    Segment(P p1, P p2) : p1(p1), p2(p2) {}
};
typedef Segment L;

//Circle
struct Circle
{
    P p;
    double r;
    Circle(const P &p, double r) : p(p), r(r) {}
};
typedef Circle C;

//ノルム
//二点a,bを投げるとノルムの2乗(a1-b1)^2+(a2-b2)^2を返す
double norm(P &p1, P &p2)
{
    return (p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y);
}

//外積cross(a,b) = |a||b|sinθ=a1b2-a2b1
//二点a,bを投げると外積を返す
double cross(const P &a, const P &b)
{
    return (conj(a) * b).Y;
}

//内積dot(a,b) = |a||b|cosθ=a1b1+a2b2
//二点a,bを投げると内積を返す
double dot(const P &a, const P &b)
{
    return (conj(a) * b).X;
}

//射影
//L(又はS)と点Pを投げるとLへPを射影した座標を返す
//依存:dot,norm
P Projection(L l, P p)
{
    P base = l.p2 - l.p1;                        //始点
    double r = dot(p - l.p1, base) / norm(base); //線分に対する倍率の計算
    return l.p1 + base * r;
}

//鏡映
//L(又はS)と点Pを投げるとLを軸としたPの鏡像座標を返す
//依存:Projection,dot,norm
P Reflection(L l, P p)
{
    return p + (Projection(l, p) - p) * 2.0;
}

//位置関係判定(線分abを軸にcがどちら側にあるか)
//三点a,b,cを投げることで，a-bを軸として
//時計回りの場合:1,反時計回りの場合:-1,c-a-bの並び:2,a-b-cの並び:-2
//その他（重なってる等）:0
//依存:cross,dot,norm
int ccw(P a, P b, P c)
{
    b -= a;
    c -= a; //aからの向きを考える
    if (cross(b, c) > EPS)
        return +1; //clockwise
    else if (cross(b, c) < -EPS)
        return -1; //counter clockwise
    else if (dot(b, c) < -EPS)
        return +2; //c-a-b
    else if (norm(b) < norm(c))
        return -2; //a-b-c
    else
        return 0; //他
}

//Intersection Determination
//L,S,Pそれぞれのペアの交差判定，PPは直接比較できるのでないです
//それぞれのペアを投げる,引数の順番は関数名に記載
//交差又は含まれている場合true,そうでない場合falseを返す

//依存:cross
bool intersectLL(const L &l, const L &m)
{
    return abs(cross(l.p2 - l.p1, m.p2 - m.p1)) > EPS || // non-parallel
           abs(cross(l.p2 - l.p1, m.p1 - l.p1)) < EPS;   // same L
}
//依存:cross
bool intersectLS(const L &l, const L &s)
{
    return cross(l.p2 - l.p1, s.p1 - l.p1) * // s.p1 is left of l
               cross(l.p2 - l.p1, s.p2 - l.p1) <
           EPS; // s.p2 is right of l
}
//依存:cross
bool intersectLP(const L &l, const P &p)
{
    return abs(cross(l.p2 - p, l.p1 - p)) < EPS;
}
//依存:ccw,cross,dot,norm
bool intersectSS(const L &s, const L &t)
{
    return ccw(s.p1, s.p2, t.p1) * ccw(s.p1, s.p2, t.p2) <= 0 &&
           ccw(t.p1, t.p2, s.p1) * ccw(t.p1, t.p2, s.p2) <= 0;
}

bool intersectSP(const L &s, const P &p)
{
    return abs(s.p1 - p) + abs(s.p2 - p) - abs(s.p2 - s.p1) < EPS; // triangle inequality
}

//distance
//L,S,Pについてペアを投げるとその距離を計算
//引数の順番は関数名参照

//依存:Projection,dot,norm
double distanceLP(const L &l, const P &p)
{
    return abs(p - Projection(l, p));
}
//依存:intersectLL,cross,distanceLP,Projection,dot,norm
double distanceLL(const L &l, const L &m)
{
    return intersectLL(l, m) ? 0 : distanceLP(l, m.p1);
}
//依存:intersectLS,cross,distanceLP,Projection,dot,norm
double distanceLS(const L &l, const L &s)
{
    if (intersectLS(l, s))
        return 0;
    return min(distanceLP(l, s.p1), distanceLP(l, s.p2));
}
//依存:intersectSP,Projection,dot,norm
double distanceSP(const L &s, const P &p)
{
    const P r = Projection(s, p);
    if (intersectSP(s, r))
        return abs(r - p);
    return min(abs(s.p1 - p), abs(s.p2 - p));
}
//依存:intersectSS,ccw,cross,dot,norm,distanceSP,intersectSP,Projection
double distanceSS(const L &s, const L &t)
{
    if (intersectSS(s, t))
        return 0;
    return min(min(distanceSP(s, t.p1), distanceSP(s, t.p2)),
               min(distanceSP(t, s.p1), distanceSP(t, s.p2)));
}

double distancePP(const P &p1, const P &p2)
{
    return abs(p1 - p2);
}
//二本のL(又はS)を投げると交点座標を返す
//一致している場合は一本目のp1を返します
//交わっていない場合はfalseを返します
//依存:cross
P crosspoint(const L &l, const L &m)
{
    double A = cross(l.p2 - l.p1, m.p2 - m.p1);
    double B = cross(l.p2 - l.p1, l.p2 - m.p1);
    if (abs(A) < EPS && abs(B) < EPS)
        return l.p1; // same line
    if (abs(A) < EPS)
        assert(false); // !!!PRECONDITION NOT SATISFIED!!!
    return m.p1 + B / A * (m.p2 - m.p1);
}

long long Manhattan(const vector<pair<P,P>> &seg,vector<P> &cp){
    int count = 0;
    for (int i = 0; i < seg.size();i++){
        L li = L(seg[i].first, seg[i].second);
        for (int j = i + 1; j < seg.size();j++){
            L lj = L(seg[j].first, seg[j].second);
            if(intersectSS(li,lj)){
                cp.push_back(crosspoint(li,lj));
                count++;
            }
        }
        if(i+2==seg.size())
            break;
    }
    return count;
}
//外接円
//点を三つ投げると中心点と半径が出る

pair<P, double> circumcircle(const P &p, const P &q, const P &r){
    double a=p.X,b=p.Y,c=q.X,d=q.Y,e=r.X,f=r.Y;
    double aa = a * a, bb = b * b, cc = c * c,dd = d * d, ee = e * e, ff = f * f;
    double cx,cy = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee - ff)) / (2 * (e - a) * (b - d) - 2 * (c - a) * (b - f));
    if(c==a){
        cx = (2 * (b - f) * cy - aa - bb + ee + ff) / (2 * (e - a));
    }else{
        cx = (2 * (b - d) * cy - aa - bb + cc + dd) / (2 * (c - a));
    }
    P ans = P(cx, cy);
    double R = abs(ans - p);
    return make_pair(ans, R);
}

int main(){
    int n;
    cin >> n;
    
    for (int i = 0; i < n;i++){
        double x1, x2, y1, y2,x3,y3;
        cin >> x1 >> y1 >> x2 >> y2>>x3>>y3;
        P a = P(x1, y1), b = P(x2, y2), c = P(x3, y3);
        pair<P,double> ans=circumcircle(a,b,c);
        double x = ans.first.X, y = ans.first.Y;
        x = round(x * 1000) / 1000;
        y = round(y * 1000) / 1000;
        ans.second = round(ans.second * 1000) / 1000;
        printf("%.3f %.3f %.3f\n", x,y, ans.second);
    }

    return 0;
}