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>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
int n;
double a,b,c,d,e,f;
pair<double,double> func(double A,double B,double C,double D,double E,double F){
    double ans1=(C*E-B*F)/(A*E-B*D),ans2=(C*D-A*F)/(B*D-A*E);
    if(C*E==B*F)ans1=0;
    if(C*D==A*F)ans2=0;
    return {ans1,ans2};
}
signed main(){
    cin>>n;
    rep(i,n){
        cin>>a>>b>>c>>d>>e>>f;
        double A=2*(-a+c),B=2*(-b+d),C=a*a+b*b-c*c-d*d;
        double D=2*(-a+e),E=2*(-b+f),F=a*a+b*b-e*e-f*f;
        pair<double,double> p=func(A,B,-C,D,E,-F);
        double ans1=p.first,ans2=p.second;
        printf("%.3lf %.3lf %.3lf\n",ans1,ans2,hypot(a-ans1,b-ans2));
    }
    ggr;
}

C++: #include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
typedef struct POINT
{
    double x;
    double y;
}POINT;
double dist(POINT a,POINT b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
bool cocircle(POINT p1,POINT p2,POINT p3,POINT &q,double &r)
{
  double x12=p2.x-p1.x;
  double y12=p2.y-p1.y;
  double x13=p3.x-p1.x;
  double y13=p3.y-p1.y;
  double z2=x12*(p1.x+p2.x)+y12*(p1.y+p2.y);
  double z3=x13*(p1.x+p3.x)+y13*(p1.y+p3.y);
  double d=2.0*(x12*(p3.y-p2.y)-y12*(p3.x-p2.x));
  //if(abs(d)<EP)                           //共&#32447;，&#22278;不存在
     //return false;
  q.x=(y13*z2-y12*z3)/d;
  q.y=(x12*z3-x13*z2)/d;
  r=dist(p1,q);
  return true;
}
int main()
{
    int n;
    double x1,x2,x3,y1,y2,y3,xp,yp,r;
    cin>>n;
    while(n--)
    {
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        POINT A,B,C,P;
        A.x=x1;
        A.y=y1;
        B.x=x2;
        B.y=y2;
        C.x=x3;
        C.y=y3;
        cocircle(A,B,C,P,r);
        cout<<fixed << setprecision(3)<<P.x<<' '<<P.y<<' '<<r<<endl;
    }

    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <complex>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

// 2直線の交点
P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // 交点がない
  return a1 + d1/d2 * (a2-a1);
}

// 三角形の外心。点a,b,cは同一線上にあってはならない
P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main() {
  int n;
  cin >> n;
  D x1,y1,x2,y2,x3,y3;
  rep(_,n) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    P a = P(x1,y1);
    P b = P(x2,y2);
    P c = P(x3,y3);
    P center = circumcenter(a,b,c);
    printf("%.3lf %.3lf %.3lf\n", center.X, center.Y, abs(center - a));
  }
  return 0;
}

C++: #include<cstdio>
#include<cmath>
//#include<iostream>
using namespace std;

int main(){
	int n;
	float x1, y1, x2, y2, x3, y3, xp,yp, xq, yq, s1, sr1, s2, sr2;
	float b1, b2, xc, yc, r;
	scanf("%d", &n);
	while(n--){
		scanf("%f%f%f%f%f%f",&x3, &y3, &x2, &y2, &x1, &y1);
		xp=(x2+x1)/2; yp=(y2+y1)/2;
		xq=(x3+x1)/2; yq=(y3+y1)/2;
		sr1=-(x2-x1)/(y2-y1); b1=yp-sr1*xp;
		sr2=-(x3-x1)/(y3-y1); b2=yq-sr2*xq;

		xc=-(b1-b2)/(sr1-sr2);
		yc=sr1*xc+b1;
		r=sqrt((xc-x1)*(xc-x1)+(yc-y1)*(yc-y1));
		printf("%.3f %.3f %.3f\n",xc, yc, r);
	}
	return 0;
}