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 <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

struct point{
	double x,y;
	point operator+(point Gep){
		return point{x+Gep.x,y+Gep.y};
	}
	point operator-(point Gep){
		return point{x-Gep.x,y-Gep.y};
	}
	point operator*(double Gex){
		return point{x*Gex,y*Gex};
	}
	point operator/(double Gex){
		if(!Gex) return point{0,0}; 
		return point{x/Gex,y/Gex};
	}
	bool operator==(point Gep){
		return fabs(x-Gep.x)<eps&&fabs(y-Gep.y)<eps;
	}
};

class Geom{
	private:
	vector<point> Ge;
	vector<pair<point,point> > Geseg,Geline;
	public:
	void line_push(point Gex,point Gey){
		Geline.push_back(make_pair(Gex,Gey));
	}
	void seg_push(point Gex,point Gey){
		Geseg.push_back(make_pair(Gex,Gey));
	}
	void point_push(point Gex){
		Ge.push_back(Gex);
	}
	point DIP(pair<point,point> Gex,pdd Gey){
		double Gea=Gey.first,Geb=Gey.second;
		point Ge1=Gex.first,Ge2=Gex.second;
		return (Ge1*Geb+Ge2*Gea)/(Gea+Geb);
	}
	point POI(pair<point,point>Gex,pair<point,point> Gey){
		pair<point,point> Ge1(PRO(Gex,Gey.first),PRO(Gex,Gey.second));
		pdd Ger(EXTLEN(Gey.first,Ge1.first),EXTLEN(Gey.second,Ge1.second));
		return DIP(Ge1,Ger);
	}
	double IP(point Gex,point Gey){
		return Gex.x*Gey.x+Gex.y*Gey.y;
	}
	double CP(point Gex,point Gey){
		return Gex.x*Gey.y-Gey.x*Gex.y;
	}
	double LEN(point Gex){
		return sqrt(Gex.x*Gex.x+Gex.y*Gex.y);
	}
	double EXTLEN(point Gex,point Gey){
		return LEN(Gex-Gey);
	}
/*	double SLEN(pair<point,point> Gex,pair<point,point> Gey){
		double Getmp=PJUD(Gex,Gey);
		if(Getmp==inf) return 0;
		point Ge1=Gex.first,Ge2=Gex.second,Ge3=Gey.first,Ge4=Gey.second;
		if(Getmp==-1) return min(min(EXTLEN(Ge1,Ge3),EXTLEN(Ge1,Ge4)),min(EXTLEN(Ge2,Ge3),EXTLEN(Ge2,Ge4)));
		if()
	}*/
	double HELON(point Gex,point Gey,point Gez){
		double Gea=EXTLEN(Gex,Gey),Geb=EXTLEN(Gey,Gez),Gec=EXTLEN(Gey,Gez);
		double Ges=(Gea+Geb+Gec)/2;
		return sqrt(Ges*(Ges-Gea)*(Ges-Geb)*(Ges-Gec));
	}
	point PRO(pair<point,point> Gea,point Gex){
		point Ge1=Gex-Gea.second,Ge2=Gea.first-Gea.second;
		return Ge2*(IP(Ge1,Ge2)/(LEN(Ge2)*LEN(Ge2)))+Gea.second;
	}
	point REF(pair<point,point> Gea,point Gex){
		point Ge1=PRO(Gea,Gex);
		return Ge1*2-Gex;
	}
	point REVO(point Gex,point Ger,double Gey){
		point Getmp=Gex-Ger;
		return point{Getmp.x*cos(Gey)-Getmp.y*sin(Gey)+Ger.x,Getmp.x*sin(Gey)+Getmp.y*cos(Gey)+Ger.y};
	}
	point CIR(point Gex,point Gey,point Gez){
		point Ge1=(Gex+Gey)/2,Ge2=(Gey+Gez)/2;
		pair<point,point> Gea(REVO(Gex,Ge1,pi/2),REVO(Gey,Ge1,pi/2)),Geb(REVO(Gey,Ge2,pi/2),REVO(Gez,Ge2,pi/2));
		return POI(Gea,Geb);
	}
	int PJUD(point Gea,point Geb,point Gex){
		if(Gea==Geb||Gex==Geb) return 0;
		point Ge1=Gea-Gex,Ge2=Geb-Gex;
		double Getmp=CP(Ge1,Ge2);
		if(Getmp>eps) return 1;
		if(Getmp<-eps) return 2;
		if(IP(Ge1,Ge2)<eps) return 3;
		if(LEN(Ge1)<LEN(Ge2)) return 4;
		return 5;
	}
	int SJUD(pair<point,point> Gex,pair<point,point> Gey){
		if(four_JUD(Gex.first,Gex.second,Gey.first,Gey.second)){
			int Ge1=PJUD(Gex.first,Gey.first,Gex.second),Ge2=PJUD(Gex.first,Gey.second,Gex.second),Ge3=PJUD(Gey.first,Gex.first,Gey.second),Ge4=PJUD(Gey.first,Gex.second,Gey.second);
			if((Ge1==3||Ge1==4)&&(Ge2==3||Ge2==4)&&(Ge3==3||Ge3==4)&&(Ge4==3||Ge4==4)) return -1;
			return inf;
		}
		if(LJUD(Gex,Gey)==2) return 0;
		point Getmp=POI(Gex,Gey);
		int Ge1=PJUD(Gex.first,Getmp,Gex.second),Ge2=PJUD(Gey.first,Getmp,Gey.second);
		if((!Ge1||Ge1==5)&&(!Ge2||Ge2==5)) return 1;
		return 0;
	}
	int LJUD(pair<point,point> Gex,pair<point,point> Gey){
		point Ge1=Gex.first-Gex.second,Ge2=Gey.first-Gey.second;
		if(!CP(Ge1,Ge2)) return 2;
		if(!IP(Ge1,Ge2)) return 1;
		return 0;
	}
	bool four_JUD(point Gea,point Geb,point Gec,point Ged){
		int Ge1=PJUD(Gea,Geb,Gec),Ge2=PJUD(Gea,Geb,Ged);
		if(Ge1!=1&&Ge1!=2&&Ge2!=1&&Ge2!=2) return 1;
		return 0;
	}
/*	double AREA(){
		double Geans=0;
		for(int i=1;i<Ge.size()-1;i++){
			Geans+=HELON(Ge[0],Ge[i],Ge[i+1]);
		}
		return Geans;
	}*/
	pair<point,point> line_open(int Gex){
		return Geline[Gex];
	}
	point point_open(int Gex){
		return Ge[Gex];
	}
	pair<point,point> seg_open(int Gex){
		return Geseg[Gex];
	}
};

int q;

int main(){
	cout<<shosu(3);
	cin>>q;
	for(int i=0;i<q;i++){
		Geom geo;
		for(int j=0;j<3;j++){
			double x,y;
			cin>>x>>y;
			geo.point_push(point{x,y});
		}
		point ans=geo.CIR(geo.point_open(0),geo.point_open(1),geo.point_open(2));
		cout<<ans.x<<' '<<ans.y<<' '<<geo.EXTLEN(geo.point_open(0),ans)<<endl;
	}
}