Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		circleTriangle()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func circleTriangle() {
	var x1, y1, x2, y2, x3, y3 float64
	fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)
	a := 2 * (x1 - x2)
	b := 2 * (y1 - y2)
	c := 2 * (x1 - x3)
	d := 2 * (y1 - y3)
	e := x1*x1 - x2*x2 + y1*y1 - y2*y2
	f := x1*x1 - x3*x3 + y1*y1 - y3*y3

	px := (d*e - b*f) / (a*d - b*c)
	py := (a*f - c*e) / (a*d - b*c)

	r := math.Sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py))
	fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
}

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;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#define X real()
#define Y imag()

typedef complex<double> P;
class C:public P{
	public:
	double r;
	C(double x,double y,double r):P(x,y),r(r){}
};

template<class T> sq(T x){return x*x;}
double dot(P a, P b){return a.X*b.X + a.Y*b.Y;}

P solve_eq2(double a,double b,double c,double d,double e,double f){
	double A = a*e-b*d;
	return P((c*e-b*f)/A, (a*f-c*d)/A);
}

C C_PPP(P a,P b,P c){
	P d = b-a;
	P e = c-a;
	
	double z1 = -dot(a,a);
	double z2 = -dot(b,b);
	double z3 = -dot(c,c);
	
	P f = solve_eq2(d.X, d.Y, z2-z1, e.X, e.Y, z3-z1);
	double u = z1-dot(a,f);
	
	return C(-f.X/2, -f.Y/2, sqrt(dot(f,f)/4-u));
}

int main(){
	
	int n;
	cin>>n;
	
	rep(i,n){
		double xa,ya,xb,yb,xc,yc;
		cin>>xa>>ya>>xb>>yb>>xc>>yc;
		
		C circle = C_PPP(P(xa,ya),P(xb,yb),P(xc,yc));
		
		printf("%.3lf %.3lf %.3lf\n",circle.X,circle.Y,circle.r);
	}
}

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

using namespace std;

int main(){
	
    int n;
    cin >> n;
    while(n--) {
    	
        double x1, y1, x2, y2, x3, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        
        double a1 = 2 * (x2 - x1);
        double b1 = 2 * (y2 - y1);
        double c1 = x1 * x1 -x2 * x2 + y1 * y1 - y2 * y2;
        
        double a2 = 2 * (x3 - x1);
        double b2 = 2 * (y3 - y1);
        double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
        
        double x = (b1  *c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        double y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        double r = hypot(x-x1, y-y1);
        
        cout << fixed << setprecision(3) 
        	 << x << " " << y << " " << r << "\n";
        
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);

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

inline int sgn(const double &a) { return (a < -EPS ? -1 : (a > EPS ? 1 : 0)); }

inline bool eq(const Point &a, const Point &b) { return abs(a - b) < EPS; }

inline bool operator<(const Point &a, const Point &b){
    if (sgn(a.real() - b.real()))
        sgn(a.real() - b.real()) < 0;
    return sgn(a.imag() - b.imag());
}

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

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

struct Line {
    Point p1, p2;

    Line(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}

    bool operator<(const Line &rhs) const {
        if (eq(p2, rhs.p2))
            return p1 < rhs.p1;
        return p2 < rhs.p2;
    }
    bool operator==(const Line &rhs) const {
        return (eq(p1, rhs.p1) && eq(p2, rhs.p2)) ||
               (eq(p1, rhs.p2) && eq(p2, rhs.p1));
    }
};

Point circumcenter(Point p1, Point p2, Point p3) {
  double a1, b1, c1, a2, b2, c2, cx, cy;
  a1 = real(p2 - p1);
  b1 = imag(p2 - p1);
  c1 = norm(p2) - norm(p1);
  a2 = real(p3 - p2);
  b2 = imag(p3 - p2);
  c2 = norm(p3) - norm(p2);
  cx = (b2 * c1 - b1 * c2) / (2.0 * (a1 * b2 - a2 * b1));
  cy = (a1 * c2 - a2 * c1) / (2.0 * (a1 * b2 - a2 * b1));
  return Point(cx, cy);
}

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;++i){
        double x1, y1, x2, y2, x3, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        Point c = circumcenter(Point(x1,y1),Point(x2,y2),Point(x3,y3));
        double r = abs(Point(x1,y1) - c);
        printf("%.3f %.3f %.3f\n",c.real(),c.imag(),r);
    }

    return 0;
}