Go: package main

import (
	"fmt"
	"math"
)

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

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

func cal() {
	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<cstdio>
#include<cmath>
using namespace std;

int main(){
	double x[3], y[3], n, xp, yp, r;
	scanf("%d", &n );
	for( int i=0; i<n; i++ ){
		scanf("%lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2]);
		double A1 = 2.0 * (x[1]-x[0]);
		double B1 = 2.0 * (y[1]-y[0]);
		double C1 = x[0]*x[0] - x[1]*x[1] + y[0]*y[0] - y[1]*y[1];
		double A2 = 2.0 * (x[2]-x[0]);
		double B2 = 2.0 * (y[2]-y[0]);
		double C2 = x[0]*x[0] - x[2]*x[2] + y[0]*y[0] - y[2]*y[2];
		xp = (B1*C2-B2*C1)/(A1*B2-A2*B1);
		yp = (C1*A2-C2*A1)/(A1*B2-A2*B1);
		r = sqrt( (xp-x[0])*(xp-x[0])+(yp-y[0])*(yp-y[0]) );
		printf("%.3f %.3f %.3f\n", xp, yp, r);
	}
	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

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;
		double a = -x1 + x2, b = -y1 + y2, c = (-pow(x1, 2) - pow(y1, 2) + pow(x2, 2) + pow(y2, 2)) / 2;
		double d = -x1 + x3, e = -y1 + y3, f = (-pow(x1, 2) - pow(y1, 2) + pow(x3, 2) + pow(y3, 2)) / 2;
		double y = (c*d - a*f) / (b*d - a*e);
		double x = (f - e*y) / d;
		cout << x << " " << y << hypot(x1 - x, y1 - y) << endl;
	}
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	complex<double> Ans;
	complex<double> P[3];
	for(int i=0;i<3;i++){
		cin>> P[i].real()>> P[i].imag();
	}
	complex<double> T[2];
	complex<double> K[2];
	double katamuki[2];
	for(int i=0;i<2;i++){
		T[i].real() = (P[i].real() + P[i+1].real()) / 2;
		T[i].imag() = (P[i].imag() + P[i+1].imag()) / 2;
		complex<double> N;
		N = (P[i+1]-P[i])/abs(P[i+1]-P[i]);
		K[i].real() =  N.imag();
		K[i].imag() = -N.real();
	}
	int a = (T[1]-T[0]).real();
	int b = (T[1]-T[0]).imag();
	int x0 = K[0].real();
	int y0 = K[0].imag();
	int x1 = K[1].real();
	int y1 = K[1].imag();
	int m = ( a * y0 - b * x0 ) / ( x0 * y1 - x1 * y0);
	K[1] *= m;
	Ans = K[1] + T[1];

	printf("%.3f %.3f %.3f", Ans.real(), Ans.imag(), abs(Ans-P[0]));
	printf("\n");
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(5);
	int n;
	cin>> n;
	for(int i=0;i<n;i++){
		solve();
	}
	return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
    double a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    double x,y;
    y=((e-a)*(a*a+b*b-c*c-d*d)-(c-a)*(a*a+b*b-e*e-f*f))/(2*(e-a)*(b-d)-2*(c-a)*(b-f));
    if(c-a!=0){
         x=(2*(b-d)*y-a*a-b*b+c*c+d*d)/(2*(c-a));
    }else{
        x=(2*(b-f)*y-a*a-b*b+e*e+f*f)/(2*(e-a));
    }
    double r=sqrt(pow(x-a,2)+pow(y-b,2));
    printf("%.3f %.3f %.3f",x,y,r);
    }
    
    
    return 0;
}

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

double n, r, x1, y1, x2, y2, x3, y3, xa, ya, xb, yb, xc, yc, ma, mb, mc, y_hasil, x_hasil;

int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		ma = (x2-x1)/(y1-y2);
		mb = (x3-x2)/(y2-y3);
		mc = (x3-x1)/(y1-y3);
		xa = (x1+x2)/2;
		ya = (y1+y2)/2;
		xb = (x2+x3)/2;
		yb = (y2+y3)/2;
		xc = (x3+x1)/2;
		yc = (y3+y1)/2;
		
	//	cout << ma << " " << xa << " " << mb << " " << xb << " " << yb << " " << ya << "\n";
		if(y1 - y2 == 0){
			x_hasil = (x2 + x1) / 2;
			y_hasil = mb*(x_hasil - xb) + yb;
		}else if(y2 - y3 == 0){
			x_hasil = (x2 + x3) / 2;
			y_hasil = ma*(x_hasil - xa) + ya;
		}else{
			x_hasil = (ma*xa - mb*xb + yb - ya)/(ma - mb);
			y_hasil = ma*(x_hasil - xa) + ya;
		}
		
		r = sqrt((x_hasil - x1)*(x_hasil - x1) + (y_hasil - y1)*(y_hasil - y1));
		
		cout << fixed << setprecision(3) << x_hasil << " " << y_hasil << " " << r << "\n";
	}
	return 0;
}

C++: #include <cmath>
#include <cstdio>

int main() {
	int sampleNum;
	scanf("%d", &sampleNum);
	for (; sampleNum > 0; --sampleNum) {
		double x1, y1, x2, y2, x3, y3;
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);

		double ax = x2 - x1;
		double ay = y2 - y1;
		double a = sqrt(ax * ax + ay * ay);
		double bx = x3 - x1;
		double by = y3 - y1;
		double b = sqrt(bx * bx + by * by);
		double cx = x3 - x2;
		double cy = y3 - y2;
		double c = sqrt(cx * cx + cy * cy);

		double crossabz = ax * by - ay * bx;
		double crossbcz = bx * cy - by * cx;
		double crosscaz = - cx * ay + cy * ax;

		double px, py, r;

		if (crossabz == 0 || crossbcz == 0 || crosscaz == 0) {
			if (a < b) {
				if (b < c) {
					px = (x3 + x2) / 2.;
					py = (y3 + y2) / 2.;
					r = c / 2.;
				} else {
					px = (x3 + x1) / 2.;
					py = (y3 + y1) / 2.;
					r = b / 2.;
				}
			} else {
				px = (x1 + x2) / 2.;
				py = (y1 + y2) / 2.;
				r = a / 2.;
			}
		} else {
			double sinA = crossbcz / (b * c);
			double sinB = crosscaz / (c * a);
			double sinC = crossabz / (a * b);
			double sin2A = sin(2.*asin(sinA));
			double sin2B = sin(2.*asin(sinB));
			double sin2C = sin(2.*asin(sinC));
			px = (sin2A * x1 + sin2B * x2 + sin2C * x3) / (sin2A + sin2B + sin2C);
			py = (sin2A * y1 + sin2B * y2 + sin2C * y3) / (sin2A + sin2B + sin2C);

			double s = fabs(crossabz) / 2.;
			r = a * b * c / (4. * s);
		}

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