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<stdio.h>
#include<cmath>
#include<iomanip>
using namespace std;

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

  cin >> n;
  int i=0;
  while(i < n){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double sina,R,BC = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)),p,q;
    sina = ((x2-x1)*(x3-x1) + (y2-y1)*(y3-y1)) / sqrt(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))*((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)));

    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*y3))/(2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
    R = BC/(2*sina);
    printf("%.3f %.3f %.3f\n",p,q,R);
    i++;
  }
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
struct {double x, y;} p[3], q[2], o;
int main()
{
	int n, i, j;
	double r, m[2], a, b, c, d;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < 3; j++)
			cin >> p[j].x >> p[j].y;

		q[0].x = (p[0].x + p[1].x) / 2;
		q[0].y = (p[0].y + p[1].y) / 2;
		q[1].x = (p[0].x + p[2].x) / 2;
		q[1].y = (p[0].y + p[2].y) / 2;
		m[0] = ((p[0].x == p[1].x) ? 0 : (p[1].y-p[0].y)/(p[1].x-p[0].x));
		m[1] = ((p[0].x == p[2].x) ? 0 : (p[2].y-p[0].y)/(p[2].x-p[0].x));

		if (p[0].x == p[1].x)
		{
			c = -1/m[1];
			d = q[1].x/m[1]+q[1].y;
			o.y = q[0].y;
			o.x = (d-o.y)/c;
		}
		else if (p[0].x == p[2].x)
		{
			a = -1/m[0];
			b = q[0].x/m[0]+q[0].y;
			o.y = q[1].y;
			o.x = (b-q[1].y)/a;
		}
		else
		{
			a = -1/m[0];
			b = q[0].x/m[0]+q[0].y;
			c = -1/m[1];
			d = q[1].x/m[1]+q[1].y;
			o.x = (d-b)/(a-c);
			o.y = a*o.x+b;
		}
		r = sqrt((p[0].x-o.x)*(p[0].x-o.x)+(p[0].y-o.y)*(p[0].y-o.y));
		cout << setprecision(3) << setiosflags(ios::fixed);
		cout << o.x << " " << o.y << " " << r << endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
typedef vector <double> vd;
typedef vector < vd > vvd;

vvd inverse(vvd &x){
	vvd tmp(2, vd(2));
	if (x.size()!=2) return tmp;
	double a, b, c, d, e;
	a = x[0][0];
	b = x[0][1];
    c = x[1][0];
	d = x[1][1];
    e = 1.0 / (a*d-b*c);
	tmp[0][0] = d * e;
	tmp[0][1] = -b * e;
	tmp[1][0] = -c * e;
	tmp[1][1] = a * e;
	return tmp;
}

vvd Mmult(vvd &A, vvd &B){
    int n1=A.size();
    int n2=A[0].size();
	int n3=B[0].size();
	vvd C(n1, vd(n3));
	for (int i=0; i<n1; i++)
		for (int j=0; j<n3; j++)
			C[i][j] = 0;

    for (int i=0; i<n1; i++)
		for (int j=0; j<n2; j++)
			for (int k=0; k<n3; k++)
				C[i][k] += A[i][j] * B[j][k];
    return C;
}

int main(void){
    int n;
	double x1, y1, x2, y2, x3, y3, dx1, dy1, dx2, dy2;
	vvd A(2, vd(2)), B(2, vd(1));
	cin>>n;
	for (int i=1; i<n+1; i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		dx1 = x2 - x1;
		dy1 = y2 - y1;
		dx2 = x3 - x1;
		dy2 = y3 - y1;
		A[0][0] = -dx1;
		A[0][1] = dy1;
		A[1][0] = -dx2;
		A[1][1] = dy2;
		B[0][0] = -dx1*(x1+x2)/2 + dy1*(y1+y2)/2;
		B[1][0] = -dx2*(x1+x3)/2 + dy2*(y1+y3)/2;
		B = Mmult(inverse(A), B);

		double r = pow(pow(B[0][0]-x1,2)+pow(B[1][0]-y1,2), 0.5);
	    cout<<fixed<<setprecision(3);
		cout<<B[0][0]<<" "<<B[1][0]<<" "<<r<<endl;
	}
    return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename T>
constexpr T det2(const T &a1, const T &a2, const T &b1, const T &b2) {
  return a1 * b2 - b1 * a2;
}

void solve() {
  int n;
  cin >> n;
  rep(i, n) {
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double d1 = x1 * x1 + y1 * y1, d2 = x2 * x2 + y2 * y2, d3 = x3 * x3 + y3 * y3;
    double npx = det2(d1, d2, y1, y2) + det2(d2, d3, y2, y3) + det2(d3, d1, y3, y1);
    double npy = det2(d2, d1, x2, x1) + det2(d3, d2, x3, x2) + det2(d1, d3, x1, x3);
    double dp  = 2 * (det2(x1, x2, y1, y2) + det2(x2, x3, y2, y3) + det2(x3, x1, y3, y1));
    double px = npx / dp, py = npy / dp;
    double r = hypot(px - x1, py - y1);
    printf("%.3f %.3f %.3f\n", px, py, r);
  }
}

C++: #include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<complex>
#include<cstdio>
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<a;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1);
const double inf = (int)1e8;
const double EPS=1e-10;

typedef complex<double> P;
typedef vector<P> G;
 
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};
P pin(){
    double x,y;
    char d;
    cin>>x>>y;
    P p(x,y);
    return p;
}
double cross(P a,P b){
    return imag(conj(a)*b);
}
P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  return m[0] + B / A * (m[1] - m[0]);
}
int main(void){
  int n;
  cin>>n;
  rep(i,n){
    P a=pin(),b=pin(),c=pin();
    P t1=(a+b)/2.0;
    P t2=(b+c)/2.0;
    P out=crosspointLL(L(t1,(b-a)*P(0,1)+t1),L(t2,(c-b)*P(0,1)+t2));
    printf("%.3f %.3f %.3f\n",out.real(),out.imag(),abs(out-a));
  }
  return 0;
}