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++: // 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

double roundPrec(double x, int prec) {
  double t = pow(10, prec);
  return double((int) (x * t + 0.5)) / t;
}

double f(double x) {
  return x * x;
}

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 npx = det2(y2 - y1, y3 - y1, f(x1) - f(x2) + f(y1) - f(y2), f(x1) - f(x3) + f(y1) - f(y3));
    double npy = det2(y2 - y1, y3 - y1, f(x1) - f(x2) + f(y1) - f(y2), f(x1) - f(x3) + f(y1) - f(y3));
    double dp  = 2 * det2(x2 - x1, x3 - x1, y2 - y1, y3 - y1);
    double px = npx / dp, py = npy / dp;
    double r = roundPrec(sqrt(f(px - x1) + f(py - y1)), 3);
    cout << prec(3) << roundPrec(px, 3) << ' ' << roundPrec(py, 3) << ' ' << r << endl;
  }
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

const double EPS = 1e-9;

struct Point
{
	double x, y;

	Point() : x( 0 ), y( 0 ) {}
	Point( const double x, const double y ) : x( x ), y( y ) {}
	Point( const Point &a ) : x( a.x ), y( a.y ) {}
	
	Point operator + ( const Point &a ) const
	{
		return Point( x + a.x, y + a.y );
	}

	Point& operator += ( const Point &a ) 
	{
		x += a.x;
		y += a.y;

		return *this;
	}

	Point operator - ( const Point &a ) const
	{
		return Point( x + ( -a.x ), y + ( -a.y ) );
	}

	Point& operator -= ( const Point &a )
	{
		x -= a.x;
		y -= a.y;

		return *this;
	}

	Point operator * ( const double &a ) const
	{
		return Point( x * a, y * a );
	}

	Point& operator *= ( const double &a )
	{
		x *= a;
		y *= a;

		return *this;
	}

	Point operator / ( const double &a ) const
	{
		return Point( x / a, y / a );
	}

	Point& operator /= ( const double &a )
	{
		x /= a;
		y /= a;

		return *this;
	}

	bool operator < ( const Point &a ) const
	{
		return x == a.x ? y < a.y : x < a.x;
	}

	double abs() const
	{
		return sqrt( pow( x, 2. ) + pow( y, 2. ) );
	}
};

double distance( const Point &a, const Point &b )
{
	return sqrt( pow( a.x - b.x, 2. ) + pow( a.y - b.y, 2. ) );
}

bool eq( const double &a, const double &b )
{
	return abs( a - b ) <= EPS;
}

void solve()
{
	Point A, B, C;

	cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
	double a = distance( B, C ), b = distance( C, A ), c = distance( A, B );

	double cosA = ( pow( b, 2. ) + pow( c, 2. ) - pow( a, 2. ) ) / ( 2 * b * c );
	double sinA = sin( acos( cosA ) );
	double r = abs( a / sinA ) / 2;

	Point midAB = ( A + B ) / 2, AB = B - A;
	Point normAB = Point( AB.y, -AB.x ) / AB.abs();
	
	double AM = distance( A, midAB );
	double t = sqrt( pow( r, 2. ) - pow( AM, 2. ) );
	Point res1;

	if ( eq( distance( midAB + normAB * t, A ), distance( midAB + normAB * t, C ) ) )
	{
		res1 = midAB + normAB * t;
	}
	else
	{
		res1 = midAB + normAB * -1 * t;
	}

	cout << res1.x << ' ' << res1.y << ' ' << r << endl;

	return;
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	cout.precision( 3 );
	cout << fixed;

	int n;
	cin >> n;

	REP( i, 0, n )
	{
		solve();
	}

	return 0;
}

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

double det(double a, double b, double c, double d, double e, double f, double g, double h, double i){
	double delta;
	double m[3][3] = {{a, b, c},{d, e, f},{g, h, i}};
	delta = m[0][0]*m[1][1]*m[2][2];
	delta += m[2][0]*m[0][1]*m[1][2];
	delta += m[0][2]*m[1][0]*m[2][1];
	delta -= m[0][2]*m[1][1]*m[2][0];
	delta -= m[0][0]*m[1][2]*m[2][1];
	delta -= m[2][2]*m[0][1]*m[1][0];
	return delta;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		double x1, y1, x2, y2, x3, y3, x, y, r;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double d0 = det(x1, y1, 1, x2, y2, 1, x3, y3, 1);
		double d1 = det((-((x1*x1)+(y1*y1))), y1, 1, (-((x2*x2)+(y2*y2))), y2, 1, (-((x3*x3)+(y3*y3))), y3, 1);
		double d2 = det(x1, (-((x1*x1)+(y1*y1))), 1, x2, (-((x2*x2)+(y2*y2))), 1, x3, (-((x3*x3)+(y3*y3))), 1);
		double d3 = det(x1, y1, (-((x1*x1)+(y1*y1))), x2, y2, (-((x2*x2)+(y2*y2))), x3, y3, (-((x3*x3)+(y3*y3))));
		double l, m, n;
		l = d1 / d0;
		m = d2 / d0;
		n = d3 / d0;
		x = -(l / 2);
		y = -(m / 2);
		r = sqrt((l*l + m*m - (4*n)) / 4);
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}