Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

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

int main(){
	int num;
	cin>>num;
	for(int i=0;i<num;i++){
		double a,b,c,d,e,f;
		double x1,y1,x2,y2,x3,y3;
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
	
		a=x1-x2;
		b=y1-y2;
		c=x2-x3;
		d=y2-y3;
		e=(x2*x2+y2*y2)-(x1*x1+y1*y1);
		f=(x3*x3+y3*y3)-(x2*x2+y2*y2);
		double l=(e*d-f*b)/(a*d-c*b);
		double m=(c*e-a*f)/(c*b-a*d);
		double n=-1*x1*x1-(y1*y1)-l*x1-m*y1;
	
		double x=-1*l/2.0;
		double y=-1*m/2.0;
		double r=sqrt(l*l+m*m-4*n)/2.0;
		printf("%.3f %.3f %.3f\n",x,y,r);
	}
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

#include <complex>
typedef complex<double> P;
typedef vector<P> vP;
typedef vector<double> vd;

#define EQ(x,y) (abs((x)-(y))<EPS)

double dot(P a, P b) {
	return (a.real()*b.real() + a.imag()*b.imag());
}

double cross(P a, P b) {
	return (a.real()*b.imag() - a.imag()*b.real());
}

double distance_ls_p(P a, P b, P c) {
	if(dot(b-a, c-a) < -EPS) return abs(c-a);
	if(dot(a-b, c-b) < -EPS) return abs(c-b);
	return abs(cross(b-a, c-a)) / abs(b-a);
}

P rotate(P t, P p, double r) {
	double ta = cos(r)*(t.real()-p.real())-sin(r)*(t.imag()-p.imag())+p.real();
	double tb = sin(r)*(t.real()-p.real())-cos(r)*(t.imag()-p.imag())+p.imag();
	return P(ta, tb);
}

double to_radian(double degree) {
	return degree*PI/180.0;
}

P intersection_l(P a1, P a2, P b1, P b2) {
	P a = a2 - a1;
	P b = b2 - b1;
	return a1 + a * cross(b, b1-a1) / cross(b, a);
}

double area(P a, P b, P c) {
	return abs(cross(c-a, b-a)*0.5);
}

int main() {
	int n;
	cin >> n;
	REP(_, n) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		P A(x1, y1), B(x2, y2), C(x3, y3);
		P mAB((x1+x2)/2, (y1+y2)/2), mBC((x2+x3)/2, (y2+y3)/2);
		P nAB = rotate(B, mAB, to_radian(90));
		P nBC = rotate(C, mBC, to_radian(90));

		P p = intersection_l(mAB, nAB, mBC, nBC);
		double r = abs(A-p);

		printf("%.3f %.3f %.3f\n", p.real(), p.imag(), r);
	}

	return 0;
}

C++: #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
// ------ Classes ------ //
class Point {
public:
	long double px, py;
	Point() : px(0), py(0) {};
	Point(long double px_, long double py_) : px(px_), py(py_) {};
	bool operator==(const Point& p) const { return px == p.px && py == p.py; }
	bool operator!=(const Point& p) const { return px != p.px || py != p.py; }
	bool operator<(const Point& p) const { return px < p.px ? true : (px == p.px && py < p.py); }
	bool operator>(const Point& p) const { return px > p.px ? true : (px == p.px && py > p.py); }
	bool operator<=(const Point& p) const { return !(Point(px, py) > p); }
	bool operator>=(const Point& p) const { return !(Point(px, py) < p); }
	Point operator+(const Point& p) const { return Point(px + p.px, py + p.py); }
	Point operator-(const Point& p) const { return Point(px - p.px, py - p.py); }
	Point operator/(long double d) const { return Point(px / d, py / d); }
	friend Point operator*(const Point p, long double d) { return Point(p.px * d, p.py * d); }
	friend Point operator*(long double d, const Point& p) { return p * d; }
	Point& operator+=(const Point& p1) { px += p1.px, py += p1.py; return *this; }
	Point& operator-=(const Point& p1) { px -= p1.px, py -= p1.py; return *this; }
	Point& operator*=(long double d) { px *= d, py *= d; return *this; }
	Point& operator/=(long double d) { px /= d, py /= d; return *this; }
};
class Circle {
public:
	Point p; long double r;
	Circle() : p(Point()), r(0.0L) {};
	Circle(Point p_) : p(p_), r(0.0L) {};
	Circle(Point p_, long double r_) : p(p_), r(r_) {};
	Circle(long double x_, long double y_) : p(Point(x_, y_)), r(0.0L) {};
	Circle(long double x_, long double y_, long double r_) : p(Point(x_, y_)), r(r_) {};
	bool operator==(const Circle& c) const { return p == c.p && r == c.r; }
	bool operator!=(const Circle& c) const { return !(Circle(p, r) == c); }
};
// ------ Functions ------ //
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
long double dst(const Point& a, const Point& b) { return abs(b - a); }
Point pol(long double r, long double d) { return Point(cosl(d) * r, sinl(d) * r); }
vector<Point> crp(Circle c1, Circle c2) {
	double d = abs(c1.p - c2.p);
	double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
	double t = arg(c2.p - c1.p);
	return{ c1.p + pol(c1.r, t + a), c1.p + pol(c1.r, t - a) };
}
// ------ Main ------ //
int n; Point p1, p2, p3;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p1.px >> p1.py >> p2.px >> p2.py >> p3.px >> p3.py;
		long double d1 = dst(p1, p2), d2 = dst(p2, p3), d3 = dst(p3, p1);
		long double r = d1 * d2 * d3 / sqrtl((d1 + d2 + d3) * (d1 + d2 - d3) * (d2 + d3 - d1) * (d3 + d1 - d2));
		vector<Point> v = crp(Circle(p1, r), Circle(p2, r));
		for (int j = 0; j < v.size(); j++) {
			long double d4 = dst(v[j], p3);
			if (d4 - 1e-10 <= r && r <= d4 + 1e-10) {
				if (-0.0005L <= v[j].px && v[j].px <= 0.0005) v[j].px = 0.0L;
				if (-0.0005L <= v[j].py && v[j].py <= 0.0005) v[j].py = 0.0L;
				printf("%.3Lf %.3Lf %.3Lf\n", v[j].px, v[j].py, r); break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double x1,y1,x2,y2,x3,y3,xp,yp,r;
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		xp=0;
		yp=0;
		double a=y2-y1,b=y3-y1,c=y2-y3,d=x2-x1,e=x3-x1;
		if(y1 != y2 && y1 != y3){
			xp=(c/2-e*(x1+x3)/2/b+d*(x2+x1)/2/a)/(-e/b+d/a);
			yp=-e/b*(xp-(x1+x3)/2)+(y1+y3)/2;
		}else if(y1==y2){
			xp=(x1+x2)/2;
			yp=-e/b*(xp-(x1+x3)/2)+(y1+y3)/2;
		}else if(y1==y3){
			xp=(x1+x3)/2;
			yp=-d/a*(xp-(x1+x2)/2)+(y1+y2)/2;
		}
		r = sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
		xp*=1000;
		if(xp>0)
			xp+=0.5;
		else
			xp-=0.5;
		int xp2=xp;
		yp*=1000;
		if(yp>0)
			yp+=0.5;
		else
			yp-=0.5;
		int yp2=yp;
		printf("%.3lf %.3lf %.3lf\n",xp2/(double)1000,yp2/(double)1000,r);
	}
	return 0;
}