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 <stdio.h>
#include <math.h>

struct h{
	double l;
	double m;
	double n;
	double k;
};

void getl(h *len, const double x, const double y){
	len->l = x;
	len->m = y;
	len->n = 1.0;
	len->k = -(x*x + y*y);
}

void calc(h *len, double *xp, double *yp, double *r){
	struct h th;

	for(int i=0;i<3; ++i){
		if(len[i].l != 0.0){
			if(i != 0){
				th = len[i];
				len[i] = len[0];
				len[0] = th;
			}
			len[0].m /= len[0].l;
			len[0].n /= len[0].l;
			len[0].k /= len[0].l;
			len[0].l = 1.0;
			break;
		}
	}
	for(int i=1;i<3;++i){
		if(len[i].l != 0.0){
			len[i].m -= len[0].m*len[i].l;
			len[i].n -= len[0].n*len[i].l;
			len[i].k -= len[0].k*len[i].l;
			len[i].l = 0.0;
		}
	}

	for(int i=1; i<3; ++i){
		if(len[i].m != 0.0){
			if(i != 1){
				th = len[i];
				len[i] = len[1];
				len[1] = th;
			}
			len[1].n /= len[1].m;
			len[1].k /= len[1].m;
			len[1].m = 1.0;
			break;
		}
	}
	if(len[0].m != 0.0){
		len[0].n -= len[1].n*len[0].m;
		len[0].k -= len[1].k*len[0].m;
		len[0].m = 0.0;
	}
	if(len[2].m != 0.0){
		len[2].n -= len[1].n*len[2].m;
		len[2].k -= len[1].k*len[2].m;
		len[2].m = 0.0;
	}

	if(len[2].n != 1.0){
		len[2].k /= len[2].n;
		len[2].n = 1.0;
	}
	if(len[0].n != 0.0){
		len[0].k -= len[2].k*len[0].n;
		len[0].n = 0.0;
	}
	if(len[1].n != 0.0){
		len[1].k -= len[2].k*len[1].n;
		len[1].n = 0.0;
	}
	*xp = -len[0].k / 2;
	*yp = -len[1].k / 2;
	*r  = (*xp)*(*xp) + (*yp)*(*yp) - len[2].k;
	*r = sqrt(*r);

	*xp = floor((*xp * 1000 + 0.5))/1000;
	*yp = floor((*yp * 1000 + 0.5))/1000;
	*r = floor((*r * 1000 + 0.5))/1000;
}

int main(void){
	int n=0;
	double x[6];
	double xp,yp,r;
	struct h len[3];

	scanf("%d", &n);
	for(int i=0;i<n;++i){
		scanf("%lf %lf %lf %lf %lf %lf", x, x+1, x+2, x+3, x+4, x+5);
		getl(len  , x[0], x[1]);
		getl(len+1, x[2], x[3]);
		getl(len+2, x[4], x[5]);
		calc(len, &xp, &yp, &r);
		printf("%.3f %.3f %.3f\n", xp, yp, r);
	}
	return 0;
}

C++: #include<complex>
#include<cmath>
#include<iostream>
#include<iomanip>
using namespace std;
typedef complex<double> P;
#define F(I,J,N) for(int I=J;I<N;I++)

class Line{
public:
	P p[2];
	P v;
	Line(){}
	Line(P p0,P p1){
		p[0]=p0;
		p[1]=p1;
		v=p1-p0;
	}
	double cross(P a,P b){
		return (real(a)*imag(b)-imag(a)*real(b));
	}
	//直線交点
	P IntersectionPoint(Line l){
		return p[0] + v * cross(l.v,l.p[0]-p[0]) / cross(l.v,v);
	}
};

int main(){
	int n;
	double x,y;
	P p[3],c[2],ce;
	Line l[2];
	cout<<setprecision(3)<<setiosflags(ios::fixed);
	cin>>n;
	F(a,0,n){
		F(i,0,3){cin>>x>>y;p[i]=P(x,y);}
		c[0]=(p[0]+p[1])/2.0;
		c[1]=(p[1]+p[2])/2.0;
		l[0]=Line(c[0],c[0]+(p[1]-p[0])*P(0,1));
		l[1]=Line(c[1],c[1]+(p[2]-p[1])*P(0,1));
		ce=l[0].IntersectionPoint(l[1]);
		cout<<ce.real()<<" "<<ce.imag()<<" "<<abs(ce-p[0])<<endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    double x1,y1,x2,y2,x3,y3;
    while(cin >> x1 >> y1 >>x2 >> y2 >> x3 >> y3)
    {
        double s,v1x,v1y,v2x,v2y;
        v1x = y2-y1;
        v1y = x1-x2;

        v2x = y3-y1;
        v2y = x1-x3;
        double detA = v1x*v2y-v1y*v2x;
        double hx = (x2-x1)/2;
        double hy = (y2-y1)/2;
        s = (v2y*hx -v1y*hy)/detA;
        double ox,oy;
        ox = hx + s*v1x;
        oy = hy + s*v1y;
        if(-0.0005<ox&&ox<0)ox = 0;
        if(-0.0005<oy&&oy<0)oy = 0;
        double r = sqrt((x1-ox)*(x1-ox)+(y1-oy)*(y1-oy));
        printf("%.3f %.3f %.3f\n",ox,oy,r);
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main() {

	int n;
	double x1, x2, x3, y1, y2, y3;
	double X, Y, R;
	double a, b, c, d;

	cin >> n;

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

		a = x2 - x1;
		b = x3 - x1;
		c = y2 - y1;
		d = y3 - y1;
	
		X = 0.5*((a*a*d - b*b*c) + c*d*(d - c)) / (a*d - b*c);
		Y = 0.5*(a*b*(a - b) + (b*c*c - a*d*d)) / (b*c - a*d);
		R = sqrt(X*X + Y*Y);

		X += x1;
		Y += y1;
		//?°???°????¬¬??????????????¨?????\
		if (X > 0)
			X = (int)(X * 1000 + 0.5);
		else X = (int)(X * 1000 - 0.5);

		if (Y>0)
			Y = (int)(Y * 1000 + 0.5);
		else Y = (int)(Y * 1000 - 0.5);

		if (R < 0)
			R = -R;
		R = (int)(R * 1000 + 0.5);

		
		printf("%.3lf %.3lf %.3lf\n", X/1000 , Y /1000, R /1000);
	}

	return 0;
}

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

#define MAX 1000000

using namespace std;

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

	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double x = ((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));
		double y = ((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));

		printf("%.3f %.3f %.3f\n", x, y, sqrt(pow((x1 - x), 2) + pow((y1 - y), 2)));
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
  
int main(){
    double x1,x2,x3,y1,y2,y3,r,xp,yp;
    int n;
    scanf("%d",&n);
    for(int i = 0 ; i < n ; i++){
	scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
 
	xp = (y2-y3)*(x1*x1+y1*y1)+(y3-y1)*(x2*x2+y2*y2)+(y1-y2)*(x3*x3+y3*y3);
	xp /= 2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2));
	yp = (x2-x3)*(x1*x1+y1*y1)+(x3-x1)*(x2*x2+y2*y2)+(x1-x2)*(x3*x3+y3*y3);
	yp /= 2*(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2));
	r = sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
	printf("%.3lf %.3lf %.3lf\n",xp,yp,r);
    }
    return 0;
}

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

int main(){

  long double x1,x2,x3,y1,y2,y3;
  long double p,q,r;
  int tmp;
  int n;

  cin >> n;

  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    p = ((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));

    q = ((x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*x1 -x3*x3 +y1*y1 -y3*x3)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));

    r = sqrt((x1-p)*(x1-p) + (y1-q)*(y1-q));

    printf("%.3Lf %.3Lf %.3Lf\n", p, q, r);
  }
}

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

using namespace std;

double sisya(double a) {
	a *= 1000.0;
	if (a-(int)a >= 0.5) {
		a += 1.0;
	}
	a /= 1000.0;
	return a; 
}

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, b, c;
		a = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
		b = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
		c = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		double s = (a+b+c)/2.0;
		double S = sqrt(s*(s-a)*(s-b)*(s-c));
		double p1, p2, pr;
		p1 = (a*a*(b*b+c*c-a*a)*x1+b*b*(c*c+a*a-b*b)*x2+c*c*(a*a+b*b-c*c)*x3)/(16.0*S*S);
		p2 = (a*a*(b*b+c*c-a*a)*y1+b*b*(c*c+a*a-b*b)*y2+c*c*(a*a+b*b-c*c)*y3)/(16.0*S*S);
		pr = (a*b*c)/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
		p1 = sisya(p1);
		p2 = sisya(p2);
		pr = sisya(pr);
		printf("%.3f %.3f %.3f\n", p1, p2, pr);
	}
	return 0;
}