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++: #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);
        double d=2*(x3-x2),e=2*(y3-y2),f=sq(x3)-sq(x2)+sq(y3)-sq(y2);
        double x=(c*e-b*f)/(a*e-b*d);
        double y=(c*d-a*f)/(b*d-a*e);
        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 <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define eps 1e-8
int main(void) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        double x1, x2, y1, y2, a, b, c, d, e, f;
        cin >> a >> b >> c >> d >> e >> f;
        x1 = c - a; y1 = d - b;
        x2 = e - a; y2 = f - b;
        double x = (y1 * (x2 * x2 + y2 * y2) - y2 * (x1 * x1 + y1 * y1)) / (2 * (y1 * x2 - x1 * y2));
        double y, r;
        if (-eps < y1 && y1 < eps) y = y2 / 2 - (x2 / y2) * (x - x2 / 2);
        else y = y1 / 2 - (x1 / y1) * (x - x1 / 2);
        r = sqrt(x * x + y * y);
//        printf("%.5f\n", r);
        x += a; y += b;
        int intx = x * 10000;
        int inty = y * 10000;
        int intr = r * 10000;
        if (intx % 10 >= 5) x = (intx + 5) / 10000.0;
        if (inty % 10 >= 5) y = (inty + 5) / 10000.0;
        if (intr % 10 >= 5) r = (intr + 5) / 10000.0;
        printf("%.3f %.3f %.3f\n", x, y, r);
    }
    return 0;
}

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 (b+c-a)/(double)2;
}

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>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
  int n;
  float x1, y1, x2, y2, x3, y3;
  cin >> n;
  REP(i, n){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    float a = 2 * (x2 - x1);
    float b = 2 * (y2 - y1);
    float e = x2 * x2 + y2 * y2 - x1 * x1 - y1 * y1;
    float c = 2 * (x3 - x2);
    float d = 2 * (y3 - y2);
    float f = x3 * x3 + y3 * y3 - x2 * x2 - y2 * y2;

    float D = 1 / (a * d - b * c);
    float A = (d * e - b * f) * D;
    float B = (-c * e + a * f) * D;
    printf("%.3f %.3f %.3f\n", A, B, sqrt(SQ(x1-A)+SQ(x1-B)));
  }
}

C++: #include <iostream>

using namespace std;

int n;
double x[4],y[4],r;

int main(){
    cin >> n;
	while(n--){
		for(int i=0;i<3;i++){
			cin >> x[i] >> y[i];
		}
		x[3]=((y[2]-y[1])*(x[1]-x[0])*(x[2]-x[0])-(y[1]-y[0])*(x[1]+x[0])*(x[2]-x[0])+(y[2]-y[0])*(x[1]-x[0])*(x[2]+x[0]))/(2*(y[2]-y[0])*(x[1]-x[0])-(y[1]-y[0])*(x[2]-x[0]));
		y[3]=(y[0]+y[1])/2-(y[1]-y[0])*(x[3]-(x[0]+x[1])/2)/(x[1]-x[0]);
		printf("%.3lf %.3lf\n",x[3],y[3]);
	}
	return 0;
}

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

int main(void)
{
	float x[3][2];
	int n;
	int xa, xb, xc;
	int ya, yb, yc;
	float ans[3];
	int i, j;
	
	scanf("%d", &n);
	
	while (n){
		for (i = 0; i < 3; i++){
			for (j = 0; j < 2; j++){
				scanf("%f", &x[i][j]);
			}
		}
		
		xa = 2 * (x[1][0] - x[0][0]);
		xb = 2 * (x[1][1] - x[0][1]);
		xc = x[0][0] * x[0][0] - x[1][0] * x[1][0] + x[0][1] * x[0][1] - x[1][1] * x[1][1];
		ya = 2 * (x[2][0] - x[0][0]);
		yb = 2 * (x[2][1] - x[0][1]);
		yc = x[0][0] * x[0][0] - x[2][0] * x[2][0] + x[0][1] * x[0][1] - x[2][1] * x[2][1];
		
		ans[0] = (xb * yc - yb * xc) / (xa * yb - ya * xb);
		ans[1] = (xc * ya - yc * xa) / (xa * yb - ya * xb);
		ans[2] = sqrt((ans[0] - x[0][0]) * (ans[0] - x[0][0]) + (ans[1] - x[0][1]) * (ans[1] - x[0][1]));
		
		for (i = 0; i < 3; i++){
			printf("%.3f", ans[i]);
		}
		printf("\n");
		
		n--;
	}
	
	return (0);
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#define PI 3.141592653589793
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double x,x2,x3,y,y2,y3,b,c,px,py,z;
		cin>>x>>x2>>x3>>y>>y2>>y3;
		b=sqrt(pow(x3-x2,2)+pow(y3-y2,2));
		c=sqrt(pow(x-x3,2)+pow(y-y3,2));
		z=asin(b/c);
		px=((y3-y)*(x2*x2-x*x+y2*y2-y*y)+(y-y2)*(x3*x3-x*x+y3*y3-y*y))/(2*(x2-x)*(y3-y)-(y2-y)*(x3-x));
		py=((x-x3)*(x2*x2-x*x+y2*y2-y*y)+(x2-x)*(x3*x3-x*x+y3*y3-y*y))/(2*(x2-x)*(y3-y)-(y2-y)*(x3-x));
		printf("%.3lf %.3lf %.3lf\n",px,py,(b/sin(z))/2);
	}
	return 0;
}