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<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main(void){

    double A1,A2,B1,B2,C1,C2,X1,X2,X3,Y1,Y2,Y3,X,Y,r;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
    cin>>X1>>X2>>X3>>Y1>>Y2>>Y3;
    A1=2*(X2-X1);
    B1=2*(Y2-Y1);
    C1=X1*X1-X2*X2+Y1*Y1-Y2*Y2;
    A2=2*(X3-X1);
    B2=2*(Y3-Y1);
    C2=X1*X1-X3*X3+Y1*Y1-Y3*Y3;

    X=(B1*C2-B2*C1)/(A1*B2-A2*B1);
    Y=(C1*A2-C2*A1)/(A1*B2-A2*B1);
    X+=0.0005,Y+=0.0005;
    X=floor(X),Y=floor(Y);

    r=sqrt((X1-X)*(X1-X)+(Y2-Y)*(Y2-Y));

    printf("%.3lf %.3lf %.3lf",X,Y,r);
    }

	return 0;
}

C++: #include <iostream>

#include <cmath>



using namespace std;



int main(){

	int n;

	double r,a,b,x[3],y[3];

	while(n){

	cin >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

	/*ツづ慊つクツづ債青板値ツづ個計ツ算*/

	a=((y[1]-y[3])*(y[1]*y[1]-y[2]*y[2]+x[1]*x[1]-x[2]*x[2])-(y[1]-y[2])*(y[1]*y[1]-y[3]*y[3]+x[1]*x[1]-x[3]*x[3]))/(2*(y[1]-y[3])*(x[1]-x[2])-2*(y[1]-y[2])*(x[1]-x[3]));

	b=((x[1]-x[3])*(x[1]*x[1]-x[2]*x[2]+y[1]*y[1]-y[2]*y[2])-(x[1]-x[2])*(x[1]*x[1]-x[3]*x[3]+y[1]*y[1]-y[3]*y[3]))/(2*(x[1]-x[3])*(y[1]-y[2])-2*(x[1]-x[2])*(y[1]-y[3]));

	r=sqrt((x[1]-a)*(x[1]-a)+(y[1]-b)*(y[1]-b));

	printf("%.3f %.3f %.3f\n",a,b,r);

	}

}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <bitset>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<long long int,long long int> 
#define ff first
#define pb push_back
#define ss second
#define ll long long 
#define ull unsigned long long
#define vi vector<long long int>
#define vii vector<pii>
#define vvi vector <vi>
#define rep(x,a,b,c) for(int x=a;x<=b;x+=c)
#define repp(x,a,b) rep(x,a,b,1)
#define rev(x,a,b,c) for(int x=a;x>=b;x-=c)
#define revv(x,a,b) rev(x,a,b,1)
#define OO (int)2e9
#define INF (ll)1e18
 
using namespace std;

double a,b,c,d,xx,yy,x2,y2,x3,y3;
int tc;

double xc()
{
	return ((xx*xx+yy*yy)*(y2-y3)+(x2*x2+y2*y2)*(y3-yy)+(x3*x3+y3*y3)*(yy-y2))/(double)d;
}

double yc()
{
	return ((xx*xx+yy*yy)*(x3-x2)+(x2*x2+y2*y2)*(xx-x3)+(x3*x3+y3*y3)*(x2-xx))/(double)d;
}

double rads()
{
	return sqrt(abs(xx-xc())*abs(xx-xc())+abs(yy-yc())*abs(yy-yc()));
}

double findabc()
{
	a=sqrt((abs(x2-xx))*(abs(x2-xx))+(abs(y2-yy))*(abs(y2-yy)));
	b=sqrt((abs(x3-x2))*(abs(x3-x2))+(abs(y3-y2))*(abs(y3-y2)));
	c=sqrt((abs(x3-xx))*(abs(x3-xx))+(abs(y3-yy))*(abs(y3-yy)));
	d=2*(xx*(y2-y3)+x2*(y3-yy)+x3*(yy-y2));
}

int main()
{
	scanf("%d",&tc);
	while(tc--)
	{
		scanf("%lf %lf %lf %lf %lf %lf",&xx,&yy,&x2,&y2,&x3,&y3);
		findabc();
		//printf("%.3lf %.3lf %.3lf",a,b,c);
		printf("%.3lf %.3lf %.3lf\n",xc(),yc(),rads());
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n; scanf("%d", &n);
	rep(i, n) {
		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 = -x2 + x3, e = -y2 + y3, f = (-pow(x2, 2) - pow(y2, 2) + pow(x3, 2) + pow(y3, 2)) / 2;
		double y = (c*d - a*f) / (b*d - a*e);
		if (isnan(y))y = 0;
		double x = (c - b*y) / a;
		if (isnan(x))x = 0;
		printf("%.3lf %.3lf %.3lf\n", x, y, hypot(x1 - x, y1 - y));
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

double distance(double x1, double y1, double x2, double y2){
    return sqrt(pow(abs(x1-x2), 2)+pow(abs(y1-y2), 2));
}

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 = distance(x1, y1, x2, y2), b = distance(x2, y2, x3, y3), c = distance(x3, y3, x1, y1);
        double s = (a+b+c)/2;
        double r = (a*b*c)/(4.*sqrt(s*(s-a)*(s-b)*(s-c)));
        double a1 = 2*(x2-x1), b1 = 2*(y2-y1), c1 = x1*x1-x2*x2+y1*y1-y2*y2;
        double a2 = 2*(x3-x1), b2 = 2*(y3-y1), 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);
        printf("%.3f %.3f %.3f\n", x, y, r);
    }
}

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

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double x12, y12, x13, y13;
		x12 = (x1 + x2) / 2.0;
		y12 = (y1 + y2) / 2.0;
		x13 = (x1 + x3) / 2.0;
		y13 = (y1 + y3) / 2.0;
		double vx12, vy12, vx13, vy13;
		vx12 = x2-x1;
		vy12 = y2-y1;
		vx13 = x3-x1;
		vy13 = y3-y1;
		double x, y;
		x = (vx12*vy13*x12-vx13*vy12*x13+vy12*vy13*(y13-y12))/(vx12*vy13-vx13*vy12);
		y = y13 - vx13*(x-x13)/vy13;
		double r;
		r = sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
		int X,Y,R;
		X = x * 10000.0;
		Y = y * 10000.0;
		R = r * 10000.0;
		if (X % 10 >= 5) {
			X += 10;
		}
		if (Y % 10 >= 5) {
			Y += 10;
		} 
		if (R % 10 >= 5) {
			R += 10;
		}
		x = (double)X / 10000.0;
		y = (double)Y / 10000.0;
		r = (double)R / 10000.0;
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

C++: #include<iostream>
#include<math.h>

using namespace std;

#define MAX 256

float LOSER(float x){
	if((int)(x*10000)%10 > 4)return x + 0.001;
	return x;
}

int main(void){
	int n,i = 0;
	float x1,y1,x2,y2,x3,y3;
	float px[MAX],py[MAX],r[MAX];
	
	cin >> n;
	while(i < n){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		px[i] = ((y1-y3)(y1*y1-y2*y2+x1*x1-x2*x2)+(y1-y2)(y1*y1-y3*y3+x1*x1-x3*x3))/(2*(y1-y3)(x1-x2)+2*(y1-y2)(x1-x3));
		py[i] = ((x1-x3)(x1*x1-x2*x2+y1*y1-y2*y2)+(x1-x2)(x1*x1-x3*x3+y1*y1-y3*y3))/(2*(x1-x3)(y1-y2)+2*(x1-x2)(y1-y3));
		r[i] = sqrt((px[i]-x1)*(px[i]-x1)+(py[i]-y1)*(py[i]-y1));
		LOSER(px[i]);
		LOSER(py[i]);
		LOSER(r[i]);
		i++;
	}
	
	for(int i = 0;i < n;i++){
		scanf("%.3f %.3f %.3f",px[i],py[i],r[i]);
	}

	return 0;
}

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

int main(){

	int n;
	double x1, y1, x2, y2, x3, y3;
	double la, lb, lc;
	double a, b, c;
	
	double r;
	double px, py;

	cin >> n;

	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		lc = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
		la = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
		lb = (x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1);

		a = fabs((atan2( y2 - y1, x2 - x1 ) - atan2( y3 - y1, x3 - x1 )));
		b = fabs((atan2( y1 - y2, x1 - x2 ) - atan2( y3 - y2, x3 - x2 )));
		c = fabs((atan2( y1 - y3, x1 - x3 ) - atan2( y2 - y3, x2 - x3 )));

		r = sqrt(la) / (sin(a)*2);
		px = ( sin(2*a) * x1 + sin(2*b) * x2 + sin(2*c) * x3 ) / (sin(2*a)+sin(2*b)+sin(2*c));
		py = ( sin(2*a) * y1 + sin(2*b) * y2 + sin(2*c) * y3 ) / (sin(2*a)+sin(2*b)+sin(2*c));

		r = floor(r*1000+0.5)/1000;
		px = floor(px*1000+0.5)/1000;
		py = floor(py*1000+0.5)/1000;

		cout << setprecision(4) << fixed  << px << " " << py << " " << r << endl;

	}
	return 0;
}