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 <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int main(void){
    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), a2 = 2 * (x3 - x1),
               b1 = 2 * (y2 - y1), b2 = 2 * (y3 - y1),
               c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2,
               c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3,
               px = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1),
               py = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1),
               r = sqrt(pow(x1 - px, 2) + pow(y1 - py, 2));

        printf("%.3f %.3f %.3f\n", px, py, r);
    }
 
    return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main() {
	float x1, x2, x3, px, y1, y2, y3, py,r,n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		if (y1 == y2) {
			px = (x1 + x2) / 2;
			py = (x1 - x3)*(x2 - x3) / (2 * (y3 - y1)) + (y1 + y3) / 2;
		}
		else if (y1 == y3) {
			px = (x1 + x3) / 2;
			py = (x1 - x2)*(x3 - x2) / (2 * (y2 - y1)) + (y1 + y2) / 2;
		}
		else {
			px = ((x1*x1 - x2*x2) / (y2 - y1) - (x1*x1 - x3*x3) / (y3 - y1) + y3 - y2) / (2 * ((x1 - x2) / (y2 - y1) - (x1 - x3) / (y3 - y1)));
			py = (px - (x1 + x2) / 2)*(x1 - x2) / (y2 - y1) + (y1 + y2) / 2;
		}
		r = sqrt((px - x1)*(px - x1) + (py - y1)*(py - y1));
		px = float(int(1000 * px + 0.5)) / 1000;
		py = float(int(1000 * py + 0.5)) / 1000;
		r = float(int(1000 * r + 0.5)) / 1000;
		cout << px << " " << py << " " << r << endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <complex>
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef complex<double> P;
int n;
 
double cross(P p1,P p2) {
    return (real(p1)*imag(p2) - imag(p1)*real(p2));
}
double calc_S(P p1,P p2,P p3) {
    double ret = 0.0;
    p1 -= p3;
    p2 -= p3;
 
    ret = cross(p1,p2)/2.0;
     
    return abs(ret);
}
 
int main() {
    cin>>n;
    while(n-->0) {
        double x1_,y1_;
        double x2_,y2_;
        double x3_,y3_;
        cin>>x1_>>y1_>>x2_>>y2_>>x3_>>y3_;
        P p1(x1_,y1_);
        P p2(x2_,y2_);
        P p3(x3_,y3_);
        P A = p1-p2;
        P B = p2-p3;
        P C = p1-p3;
        double S = calc_S(p1,p2,p3);
        double R = abs(A)*abs(B)*abs(C)/S;
        R /= 4.0;
         
        P A1 = 2.0*(p2-p1);
        P B1 = 2.0*(p3-p1);
        P C1 = P(norm(p1)-norm(p2),norm(p1)-norm(p3));
        double X = cross(P(imag(A1),imag(B1)),C1)/cross(A1,B1);
        double Y = cross(C1,P(real(A1),real(B1)))/cross(A1,B1);
        printf("%.3lf %.3lf %.3lf\n",X,Y,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 - 1e-10 <= v[j].px && v[j].px < 0.0005L + 1e-10) v[j].px = 0.0L;
				if (-0.0005L - 1e-10 <= v[j].py && v[j].py < 0.0005L + 1e-10) v[j].py = 0.0L;
				printf("%.3Lf %.3Lf %.3Lf\n", v[j].px, v[j].py, r); break;
			}
		}
	}
	return 0;
}