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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


int main(){
	ios::sync_with_stdio(false);

	int n;
	vd x(3), y(3);
	double a1, a2, b1, b2, c1, c2;
	double px, py, r;

	scanf("%d", &n);

	for (; n > 0; n--){
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];

		a1 = 2 * (x[1] - x[0]);
		b1 = 2 * (y[1] - y[0]);
		c1 = x[0] * x[0] - x[1] * x[1] + y[0] * y[0] - y[1] * y[1];

		a2 = 2 * (x[2] - x[0]);
		b2 = 2 * (y[2] - y[0]);
		c2 = x[0] * x[0] - x[2] * x[2] + y[0] * y[0] - y[2] * y[2];

		px = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
		py = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
		r = sqrt((px - x[0])*(px - x[0]) + (py - y[0])*(py - y[0]));

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

}

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

using namespace std;
typedef complex<double> P;

int main(){
  int n;
  scanf("%d",&n);
  while(n--){
    P a,b,c;
    cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag();
    P m = (a+b)/P(2,0);
    P n = (a+c)/P(2,0);
    P s = (a-b)*P(0,1);
    P t = (a-c)*P(0,1);
    double e = (t.imag()+s.real())/(conj(s)*t).imag();
    P o = m+s*P(e,0);
    double r = abs(a-o);
    printf("%.3f %.3f %.3f",o.real(),o.imag(),r);
  }
}

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

void solve(double x1, double x2, double x3, double y1, double y2, double y3) {
	double cx1 = (x1+x2)/2.0, cx2 = (x2+x3)/2.0;
	double cy1 = (y1+y2)/2.0, cy2 = (y2+y3)/2.0;
	double tx1 = y1-y2, tx2 = y2-y3;
	double ty1 = x2-x1, ty2 = x3-x2;
	double a=ty1, b=-tx1, c=cx1*ty1-cy1*tx1;
	double d=ty2, e=-tx2, f=cx2*ty2-cy2*tx2;
	double det = a*e-b*d;
	double x = (e*c-b*f)/det;
	double y = (-d*c+a*f)/det;
	double r = sqrt((x1-x)*(x1-x) + (y1-y)*(y1-y));
	printf("%.3f %.3f %.3f\n", x, y, r);
}

int main(void) {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		double x1,x2,x3,y1,y2,y3;
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		solve(x1, x2, x3, y1, y2, y3);
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
    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, B, C, s;
        a = sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
        b = sqrt(((x3 - x2) * (x3 - x2)) + ((y3 - y2) * (y3 - y2)));
        c = sqrt(((x1 - x3) * (x1 - x3)) + ((y1 - y3) * (y1 - y3)));
        A = a * a;
        B = b * b;
        C = c * c;
        s = (2 * ((A * B) + (B * C) + (C * A))) - ((A * A) + (B * B) + (C * C));
        double px, py, r;
        px = ((x3 * (A * (B + C - A))) / s) + ((x1 * (B * (C + A - B))) / s) + ((x2 * (C * (A + B - C))) / s);
        py = ((y3 * (A * (B + C - A))) / s) + ((y1 * (B * (C + A - B))) / s) + ((y2 * (C * (A + B - C))) / s);
        r = (a * b * c) / sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c));
        printf("%.3f %.3f %.3f\n", px, py, r);
    }
}

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

using namespace std;
typedef complex<double> Point;

double cross(Point a, Point b) {
  return imag(conj(a) * b); 
}

int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    double x, y;
    scanf("%lf %lf", &x, &y);
    Point c1 = Point(x, y); 
    scanf("%lf %lf", &x, &y);
    Point c2 = Point(x, y); 
    scanf("%lf %lf", &x, &y);
    Point c3 = Point(x, y); 
    double S = abs(cross(c2 - c1, c3 - c1) / 2.0);
    double a = norm(c3 - c2);
    double b = norm(c1 - c3);
    double c = norm(c2 - c1);
    Point p = (a * (b + c - a) * c1 + b * (c + a - b) * c2 + c * (a + b - c) * c3) / (16.0 * S * S); 
    printf("%.3lf %.3lf %.3lf\n", p.real(), p.imag(), abs(p - c1));
  }
}

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

struct Zahyou
{
	float x, y;
};
Zahyou de[4];

int main()
{
	int n;

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		for (int j = 1; j < 4; j++)
		{
			scanf("%f %f", &de[j].x, &de[j].y);
		}
		de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x));
		de[0].y = ((de[1].x - de[3].x)*(pow(de[1].x, 2) - pow(de[2].x, 2) + pow(de[1].y, 2) - pow(de[2].y, 2)) + (de[1].x - de[2].y)*(pow(de[1].x, 2) - pow(de[3].x, 2) + pow(de[1].y, 2) - pow(de[3].y, 2))) / (2 * (de[1].x - de[3].x)*(de[1].y - de[2].y) + 2 * (de[1].x - de[2].x)*(de[1].y - de[3].y));
		
		printf("%.1f %.1f %.3f\n",de[0].x,de[0].y,sqrt(de[0].x+de[0].y));
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
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 a1,a2,b1,b2,c1,c2,x,y,r;
         a1=2*(x1-x2);
         b1=2*(y1-y2);
         c1=x1*x1-x2*x2+y1*y1-y2*y2;
         a2=2*(x2-x3);
         b2=2*(y2-y3);
         c2=x2*x2-x3*x3+y2*y2-y3*y3;
         x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
         y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
         r=hypot(x-x1,y-y1);
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
}