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++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

double distance(double x0, double y0, double x1, double y1)
{
	double x = x1 - x0;
	double y = y1 - y0;

	return sqrt(x * x + y * y);
}

int main()
{
	int n;
	for (cin >> n; n--;)
	{
		vector<double> x(3);
		vector<double> y(3);

		for (int i = 0; i < 3; i++)
		{
			cin >> x.at(i) >> y.at(i);
		}

		double a = distance(x.at(1), y.at(1), x.at(2), y.at(2));
		double b = distance(x.at(2), y.at(2), x.at(0), y.at(0));
		double c = distance(x.at(0), y.at(0), x.at(1), y.at(1));

		double cosA = (b * b + c * c - a * a) / (2 * b * c);
		double sinA = sqrt(1 - cosA * cosA);
		double r = a / (2 * sinA);

		double cx = r * cosA;
		double cy = r * sinA;

		cout << fixed << setprecision(3);
		cout << cx << " " << cy << " " << r << endl;
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)]
#define all(v) v.begin(), v.end()
using namespace std;

template<typename T>T inner(complex<T> a,complex<T> b){
	return a.real()*b.real()+a.imag()*b.imag();
}
template<typename T>double theta(complex<T> a,complex<T> b){
	double in = inner(a,b);
	double a_abs = abs(a);
	double b_abs = abs(b);
	return acos(in/(a_abs*b_abs));
}
template<typename T>T deg(T a){
	return a*180/M_PI;
}
int main(){
	complex<double> p[3];
	int n;
	cin >> n;
	rep(i,n){
		double x,y;
		rep(j,3){
			cin >> x >> y;
			p[j] = *(new complex<double>(x,y));
		}
		complex<double> vAB = p[1]-p[0];
		complex<double> vAC = p[2]-p[0];
		complex<double> vBC = p[2]-p[1];
		double a= theta(vAB,vAC);
		double b= theta(-vAB,vBC);
		double c= theta(-vAC,-vBC);
		complex<double> vo =((sin(2*a)*p[0]+sin(2*b)*p[1]+sin(2*c)*p[2])/(sin(2*a)+sin(2*b)+sin(2*c)));
		complex<double> r = p[0]-vo;
		printf("%.3lf %.3lf %.3lf",vo.real(),vo.imag(),abs(r));
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	int n;
	cin >> n;
	rep(i, n){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double vx21, vx31, vy21, vy31, tmp1, tmp2;
		vx21 = 2 * (x1 - x2);
		vx31 = 2 * (x1 - x3);
		vy21 = 2 * (y1 - y2);
		vy31 = 2 * (y1 - y3);
		tmp1 = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;
		tmp2 = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;
		
		double x, y, r;
		x = (vx31 * tmp1 - vx21 * tmp2) / (vx31 * vy21 - vx21 * vy31);
		y = (vy31 * tmp1 - vy21 * tmp2) / (vy31 * vx21 - vy21 * vx31);
		r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
		
		printf("%.3lf %.3lf %.3lf\n", x, y, r);
		
	}
 
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

int main(){
	int n,i;
	double x1, y1, x2, y2, x3, y3;
	double det, s, t, px, py, r;

	// データセット数の入力
	cin >> n;

	// 処理
	for(i=0;i<n;i++){
		// 3点の座標の入力
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		// det の計算
		det = ((y3 - y2) * (x3 - x1)) - ((y1 - y3) * (x2 - x3));
		// det ≠ 0 かどうかチェック
		if(det == 0){
			cerr << "逆行列が存在しません" << endl;
			i--;
			break;
		}
		// 予備計算
		s = ((x3 - x1) * (x1 - x2)) + ((y3 - y1) * (y1 - y2));
		t = ((x3 - x2) * (x1 - x2)) + ((y3 - y2) * (y1 - y2));
		s /= (det * 2);
		t /= (det * 2);
		// 中心座標の計算
		px = ((x2 + x3) / 2) + s * (y3 - y2);
		py = ((y2 + y3) / 2) + s * (x2 - x3);
		// 距離の計算
		r = sqrt(((px - x1) * (px - x1)) + ((py - y1) * (py - y1)));
		// 出力
		printf("%.3f %.3f %.3f\n", px, py, r);
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
long n,i;
double x1,y1,x2,y2,x3,y3,xx,yy,rr,s;
cin>>n;
for(i=0;i<n;i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
if(cin.eof())break;
x1-=x3;x2-=x3;
y1-=y3;y2-=y3;
s=(x1*x2+y1*y2-x2*x2-y2*y2)/(x1*y2-x2*y1);
xx=x1*.5+s*y1;
yy=y1*.5-s*x1;
rr=sqrt(xx*xx+yy*yy);
xx+=x3;
yy+=y3;
printf("%.3f %.3f %.3f\n",xx,yy,rr);
}
return 0;
}