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 <vector>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <cmath>
#include <cfloat>
#include <cstdio>
#include <ctime>
#include <functional>

using namespace std;

#define EPS 1e-6

class xy{
	
public:
	double x;
	double y;

	xy(){

	}
	
	xy(double xx, double yy){
		x = xx;
		y = yy;
	}

	xy(const xy &v){
		x = v.x;
		y = v.y;
	}

	xy& operator=(const xy &v){
		x = v.x;
		y = v.y;
		return *this;
	}

	xy operator+(const xy &v) const{
		return xy(this->x+v.x, this->y+v.y);
		
	}
	
	xy operator-(const xy &v) const{
		return xy(this->x-v.x, this->y-v.y);
	}
	
	void operator+=(const xy &v){
		x+=v.x;
		y+=v.y;
	}
	void operator-=(const xy &v){
		x-=v.x;
		y-=v.y;
	}
/* something wrong this operator for sorting
	bool operator<(const xy &v){
		if(x!=v.x) return x < v.x;
		return y < v.y;
	}
	bool operator>(const xy &v){
		if(x!=v.x) return x > v.x;
		return y > v.y;
	}
*/

};
//for sorting
bool comp_xy(const xy &a, const xy &b){
	if(a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}

//u,v : vector O = (0,0)
double cross(const xy &u, const xy &v){
	return u.x*v.y - u.y*v.x;
}

//u,v : vector O = (0,0)
double dot(const xy &u, const xy &v){
	return u.x*v.x + u.y*v.y;
}

//distance between two points
double dist_p_p(const xy &a, const xy &b){
	return sqrt( fabs(dot(a-b, a-b)) );
}

//distance between a point and a line segment
double dist_p_ls(const xy &p, const xy &s1, const xy &s2){
	xy vl = s2 - s1;
	xy vp = p - s1;

	return fabs( cross(vl, vp) / sqrt( dot(vl, vl) ) );
}


class Smallest_Enclosing_Disk{
	const static int INF = (1<<30);
	priority_queue< pair<int,int> > pq;
	vector<xy> v;

	typedef struct{
		double r;
		xy O;
	}disk;
	
	pair<vector<int>, disk> make_disk_from_2_points(vector<int> R){
		disk ret;
		ret.O.x = (v[R[0]].x + v[R[1]].x) * 0.5;
		ret.O.y = (v[R[0]].y + v[R[1]].y) * 0.5;
		ret.r = dist_p_p(v[R[0]], v[R[1]]) * 0.5;
		if(ret.r == 0) R.erase(R.begin()+1);
		return make_pair(R, ret);
	}

	pair<vector<int>, disk> make_disk_from_3_points(vector<int> R){
		disk ret;
		
		if(dot(v[R[1]] - v[R[0]], v[R[2]] - v[R[0]]) <= 0){
			pair<vector<int>, disk> d = make_disk_from_2_points( vector<int>{R[1], R[2]});
			R = d.first;
			ret = d.second;
			
		}else if(dot(v[R[0]] - v[R[1]], v[R[2]] - v[R[1]]) <= 0){
			pair<vector<int>, disk> d = make_disk_from_2_points( vector<int>{R[0], R[2]});
			R = d.first;
			ret = d.second;
			
		}else if(dot(v[R[0]] - v[R[2]], v[R[1]] - v[R[2]]) <= 0){
			pair<vector<int>, disk> d = make_disk_from_2_points( vector<int>{R[0], R[1]});
			R = d.first;
			ret = d.second;
			
		}else{
			double A = dot(v[R[0]], v[R[0]]);
			double B = dot(v[R[1]], v[R[1]]);
			double C = dot(v[R[2]], v[R[2]]);

			//r(x,y) = { A(B+C-A)r_a + B(C+A-B)r_b + C(A+B-C)r_c } / 16S^2
			//16S^2 = A(B+C-A) + B(C+A-B) + C(A+B-C)

			double S_ = A*(B+C-A) + B*(C+A-B) + C*(A+B-C);
			ret.O.x = (A*(B+C-A) * v[R[0]].x + B*(C+A-B) * v[R[1]].x + C*(A+B-C) * v[R[2]].x) / S_;
			ret.O.y = (A*(B+C-A) * v[R[0]].y + B*(C+A-B) * v[R[1]].y + C*(A+B-C) * v[R[2]].y) / S_;
			ret.r = dist_p_p( v[R[0]], ret.O ) * 0.5;
		}

		return make_pair( R, ret);
	}
	
	//R := index of points which are on disk border
	//S := smallest enclosing disk
	//P := new added point
	pair<vector<int>, disk> D(vector<int> R, disk S, int P){
		//P is inside of S
		if( (dist_p_p(v[P], S.O) <= S.r) && (R.size() > 0) ){
			return make_pair(R, S);
		}
		disk ret;
		if(R.size() == 0){
			R.push_back(P);
			ret.O = v[P];
			ret.r = 0.0;
		}else if(R.size() == 1){
			R.push_back(P);
			
			pair<vector<int>, disk> d = make_disk_from_2_points(R);
			R = d.first;
			ret = d.second;
			
		}else if(R.size() == 2){
			R.push_back(P);
			pair<vector<int>, disk> d = make_disk_from_3_points(R);
			R = d.first;
			ret = d.second;
		}else if(R.size() == 3){
			vector<int> tmp_R;
			disk tmp_S;
			for(int i=0; i<3; i++){
				pair<vector<int>, disk> d = make_disk_from_3_points(vector<int>{R[i%3],R[(i+1)%3], P});

				//disk can't enclose every point
				if(dist_p_p(v[R[(i+2)%3]], d.second.O) > d.second.r){
					d.second.r = INF;
				}
				if(i==0 || d.second.r < tmp_S.r){
					tmp_R = d.first;
					tmp_S = d.second;
				}
			}
			R = tmp_R;
			ret = tmp_S;
		}
		return make_pair(R,ret);
	}

public:
	//r, xy
	Smallest_Enclosing_Disk(vector<xy> &v){
		this->v = v;
		//random key, index
		for(int i=0; i<v.size(); i++){
			pq.push( make_pair(rand(), i) );
		}
	}

	double calc(){
		vector<int> R;
		disk ret;
		while(!pq.empty()){
			pair<vector<int>, disk> d = D(R, ret, pq.top().second);
			pq.pop();
			R = d.first;
			ret = d.second;
		}
		return ret.r;
	}
};



//test
int main(){
	srand(time(NULL));
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		vector<xy> v(3);
		for(int j=0; j<3; j++){
			double x,y;
			cin >> x >> y;
			v[j] = xy(x,y);
		}
		xy O;
		double r;
		// rA = v[0]
		// rB = v[1]
		// rC = v[2]
		xy a = v[2] - v[1];
		xy b = v[2] - v[0];
		xy c = v[1] - v[0];
		double A = dot(a, a);
		double B = dot(b, b);
		double C = dot(c, c);

		//r(x,y) = { A(B+C-A)r_a + B(C+A-B)r_b + C(A+B-C)r_c } / 16S^2
		//16S^2 = A(B+C-A) + B(C+A-B) + C(A+B-C)

		double S_ = A*(B+C-A) + B*(C+A-B) + C*(A+B-C);
		O.x = (A*(B+C-A) * v[0].x + B*(C+A-B) * v[1].x + C*(A+B-C) * v[2].x) / S_;
		O.y = (A*(B+C-A) * v[0].y + B*(C+A-B) * v[1].y + C*(A+B-C) * v[2].y) / S_;
		r = dist_p_p( v[0], O );

		printf("%.3f %.3f %.3f\n", O.x, O.y, r);
	}
}