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 <algorithm>
#include <vector>
#include <cstdio>
#include <utility>
#include <complex>

using namespace std;

static const double EPS=1e-12;
static const double INF=1e24;
static const double PI=3.141592653589793;

using Point=complex<double>;
using Plane=vector<Point>;

namespace std {
    bool operator<(const Point &a, const Point &b) {
        return real(a)!=real(b)? real(a)<real(b) : imag(a)<imag(b);
    }
}

double cross_prod(const Point &a, const Point &b) {
    return imag(conj(a)*b);
}

double dot_prod(const Point &a, const Point &b) {
    return real(conj(a)*b);
}

struct Line: public pair<Point, Point> {
    Line() {}
    Line(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

struct LineSeg: public pair<Point, Point> {
    LineSeg() {}
    LineSeg(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

struct Circle {
    Point p;
    double r;
    Circle() {}
    Circle(const Point &p, const double r): p(p), r(r) {}
};

Point get_ipoint(const Line &l, const Line &m) {
    double x1=l.first.real(), x2=l.second.real();
    double x3=m.first.real(), x4=m.second.real();
    double y1=l.first.imag(), y2=l.second.imag();
    double y3=m.first.imag(), y4=m.second.imag();

    double x=(y4-y3)*(x4-x1)-(x4-x3)*(y4-y1);
    double d=(y4-y3)*(x2-x1)-(x4-x3)*(y2-y1);

    return Point(x1, y1) + (x/d)*Point(x2-x1, y2-y1);
}

bool testcase_ends() {
    double x, y;
    if (scanf("%lf %lf", &x, &y) == EOF)
        return 1;

    Point A(x, y);
    scanf("%lf %lf", &x, &y);
    Point B(x, y);
    scanf("%lf %lf", &x, &y);
    Point C(x, y);

    Line l((A+B)/2.0, (A+B)/2.0+(B-A)*polar(1.0, PI/2));
    Line m((B+C)/2.0, (B+C)/2.0+(C-B)*polar(1.0, PI/2));

    Point P=get_ipoint(l, m);
    double r=abs(P-A);
    printf("%.3f %.3f %.3f\n", P.real(), P.imag(), r);

    return 0;
}

int main() {
    size_t n;
    scanf("%zu", &n);

    for (size_t i=0; i<n; ++i)
        if (testcase_ends())
            return 1;

    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
	double n;
	double x1, x2, x3,y1,y2,y3;
	cin >> n;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	double px, py, r;
	double A = (x2 - x1)*(y3 - y2) - (y2 - y1)*(x3 - x2);
	px = 0.5*((y3 - y2)*(x2*x2 - x1*x1 + y2*y2 - y1*y1) - (y2 - y1)*(x3*x3 - x2*x2 + y3*y3 - y2*y2)) / A;
	py = 0.5*(-(x3 - x2)*(x2*x2 - x1*x1 + y2*y2 - y1*y1) + (x2 - x1)*(x3*x3 - x2*x2 + y3*y3 - y2*y2)) / A;
	double a = px - x1;
	double b = py - y1;
	double r0 = (a*a + b*b);
	double r1 = sqrt(r0);
	cout << fixed << setprecision(10) << px << " "<< py << " " << r1 <<  endl;
}

C++: #include<iostream>
#include<vector>
#include<math.h>
#include<iomanip>
using namespace std;

int main() {
	double A1, A2, A3, B1, B2, B3, C1=1, C2=1, C3=1, E1, E2, E3, x, y, z, n;
	vector<double> X, Y, Z;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A1 >> B1 >> A2 >> B2 >> A3 >> B3;
		E1 = -A1*A1 - B1*B1;
		E2 = -A2*A2 - B2*B2;
		E3 = -A3*A3 - B3*B3;
		x = (E1*B2*C3 + E2*B3*C1 + E3*B1*C2 - E1*B3*C2 - E2*B1*C3 - E3*B2*C1) / (A1*B2*C3 + A2*B3*C1 + A3*B1*C2 - A1*B3*C2 - A2*B1*C3 - A3*B2*C1);
		y = (A1*E2*C3 + A2*E3*C1 + A3*E1*C2 - A1*E3*C2 - A2*E1*C3 - A3*E2*C1) / (A1*B2*C3 + A2*B3*C1 + A3*B1*C2 - A1*B3*C2 - A2*B1*C3 - A3*B2*C1);
		z = (A1*B2*E3 + A2*B3*E1 + A3*B1*E2 - A1*B3*E2 - A2*B1*E3 - A3*B2*E1) / (A1*B2*C3 + A2*B3*C1 + A3*B1*C2 - A1*B3*C2 - A2*B1*C3 - A3*B2*C1);
		double xr, yr, r;
		xr = -x / 2; yr = -y / 2; r = sqrt((x*x + y*y) / 4 - z);
		xr *= 1000; yr *= 1000; r *= 1000;
		if (xr >= 0)xr += 0.5;
		else xr -= 0.5;
		xr = int(xr);
		xr /= 1000;
		if (yr >= 0)yr += 0.5;
		else yr -= 0.5;
		yr = int(yr);
		yr /= 1000;
		r += 0.5;
		r = int(r);
		r /= 1000;
		X.push_back(xr);
		Y.push_back(yr);
		Z.push_back(r);
	}
	for (int i = 0; i < n; i++) {
		cout << fixed << setprecision(3) << X[i] << " " << Y[i] << " " << Z[i] << endl;
	}
	return 0;
}