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 <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 <bits/stdc++.h>
using namespace std;

int main(){
	
	int N;
	cin>>N;
	while(N--){
		double x1, x2, x3,y1, y2, y3;
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		double a, b, c, d, e, f;
		double px,py,r;
		a=2.0*(x2-x1);
		b=2.0*(y2-y1);
		c=x1*x1+y1*y1-x2*x2-y2*y2;
		d=2.0*(x3-x1);
		e=2.0*(y3-y1);
		f=x1*x1+y1*y1-x3*x3-y3*y3;
		px=(b*f-c*e)/(a*e-b*d);
		py=(c*d-a*f)/(a*e-b*d);
		r=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
		printf("%.3f %.3f %.3f\n",px,py,r);
	}
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(3);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    while(n--){
        double x1,x2,x3,y1,y2,y3;
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        double a=2*(x2-x1),b=2*(y2-y1),c=sq(x2)-sq(x1)+sq(y2)-sq(y1),d=2*(x3-x2),e=2*(y3-y2),f=sq(x3)-sq(x2)+sq(y3)-sq(y2);
        double y=(c*d-a*f)/(b*d-a*e);
        double x=(c-b*y)/a;
        if(x==-0)x=0;
        if(y==-0)y=0;
        double r=sqrt(sq(x-x1)+sq(y-y1));
        cout<<x<<" "<<y<<" "<<r<<endl;
    }
}

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

using namespace std;

int main(){
	int n;
	cin >> n;

	for(int i=0; i<n; i++){
		double x1, y1, x2, y2, x3, y3;
		double px, py, r;

		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		px = (x1 + x2 + x3) / 3;
		py = (y1 + y2 + y3) / 3;
		r = sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py));

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

	return 0;
}

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

#define EPS 1e-10
#define x second
#define y first

inline int sqr(int n) { return n * n; }

struct triangle
{
    pair<double, double> p[3];
    double side[3];
    double angle;

    void init()
    {
        for (int i = 0; i < 3; i++){
            scanf("%lf %lf", &p[i].x, &p[i].y);
        }
        sort(p, p + 3);
        for (int i = 0; i < 3; i++){
            double dx = p[(i + 1) % 3].x - p[i].x;
            double dy = p[(i + 1) % 3].y - p[i].y;
            side[i] = sqrt(dx * dx + dy * dy);
        }
        angle = asin((p[2].y - p[0].y) / side[2]) + EPS;
    }

    pair<double, double> circle()
    {
        double l, m;
        double t[2], lt[4], mt[4];

        t[0] = sqr(p[1].x) - sqr(p[0].x) + sqr(p[1].y) - sqr(p[0].y);
        t[1] = sqr(p[2].x) - sqr(p[1].x) + sqr(p[2].y) - sqr(p[1].y);
        lt[0] = (p[2].y - p[1].y);
        lt[1] = (p[1].y - p[0].y);
        lt[2] = lt[0] * (p[1].x - p[0].x);
        lt[3] = lt[1] * (p[2].x - p[1].x);
        l = (t[2] - t[3]) / (lt[0] + lt[1]);
        mt[0] = (p[1].y - p[0].y);
        mt[1] = (p[2].y - p[1].y);
        mt[2] = mt[0] * (p[2].x - p[1].x);
        mt[3] = mt[1] * (p[1].x - p[0].x);
        m = (t[2] - t[3]) / (mt[0] + mt[1]);

        return make_pair(-l / 2, -m / 2);
    }
};

int main()
{
    int n;

    scanf("%d", &n);
    while (n-- > 0){
        triangle tri;
        double r;
        pair<double, double> pr;

        tri.init();
        if (tri.p[1].y != tri.p[2].y) r = tri.side[1] / sin(tri.angle) / 2;
        else r = tri.side[0] / sin(tri.angle) / 2;
        pr = tri.circle();
        printf("%f %f %f\n", pr.x, pr.y, r);
    }

    return 0;
}