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 <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

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 FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (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 ) {}
	
	const 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;
	}

	const 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;
	}

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

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

		return *this;
	}

	const 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. ) );
	}

	const Point unitVector() const
	{
		return *this / abs();
	}

	const Point normalVector1() const
	{
		return Point( y, -x );
	}

	const Point normalVector2() const
	{
		return Point( -y, x );
	}
};

// 二点間の距離
double distance( const Point &a, const Point &b )
{
	return ( a - b ).abs();
}

// 外積（クロス積）
double cross( const Point &a, const Point &b )
{
	return a.x * b.y - a.y * b.x;
}


// 直線 ( p1, p2 ) と直線 ( q1, q2 ) の交点
Point lines_intersection( const Point &p1, const Point &p2, const Point &q1, const Point &q2 )
{
	return p1 + ( p2 - p1 ) * ( cross( q2 - q1, q1 - p1 ) / cross( q2 - q1, p2 - p1 ) );
}

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

	cout << setprecision( 3 ) << fixed;

	int n;
	cin >> n;

	REP( casenum, 0, n )
	{
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		Point A( x1, y1 ), B( x2, y2 ), C( x3, y3 );
		double a = distance( B, C ), b = distance( C, A ), c = distance( A, B );

		Point midAB = ( A + B ) / 2;
		Point midAC = ( A + C ) / 2;
		
		Point p = lines_intersection( midAB, midAB + ( B - A ).normalVector1(), midAC, midAC + ( C - A ).normalVector1() );

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

		cout << p.x << ' ' << p.y << ' ' << r << endl;
	}

	return 0;
}

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

int main(){
	double a,b,c,d,e,f,x,y,A,B,C,s,r;
	int n;
	cin >> n ;
	for(int i=0;i<n;i++){
		cin >> a >> b >> c >> d >> e >> f;
		C = (a-c)*(a-c)+(b-d)*(b-d);
		A = (c-e)*(c-e)+(d-f)*(d-f);
		B = (e-a)*(e-a)+(f-b)*(f-b);
		s = 2*(A*B+B*C+C*A)-(A*A+B*B+C*C);
		x = (A*(B+C-A)*a+B*(C+A-B)*c+C*(A+B-C)*e)/s;
		y = (A*(B+C-A)*b+B*(C+A-B)*d+C*(A+B-C)*f)/s;
		A = sqrt(A);
		B = sqrt(B);
		C = sqrt(C);
		r = A*B*C/sqrt((A+B+C)*(B+C-A)*(A-B+C)*(A+B-C));
		printf("%.3lf %.3lf %.3lf\n",x,y,r);
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;

typedef double Real;

Real EPS = 1e-8;

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }
  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}

  Point operator + (Point p){return Point(add(x,p.x), add(y,p.y));}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
  Point operator * (Real d){return Point(x*d,y*d);}
  Point operator / (Real d){return Point(x/d,y/d);}
  Real norm(){return sqr(x*x+y*y);}
  Real dist(Point a){return (*this-a).norm();}
  Real dot(Point a){return x*a.x+y*a.y;}
  Real cross(Point a){return x*a.y-y*a.x;}
};

struct circle{
  Point p;
  Real r;
  circle(){}
  circle(Point p, Real r) : p(p) , r(r){}
};

circle circumscribedCircle(Point p, Point q, Point r){
  Point a,b,c;
  a=(q-p)*2,b=(r-p)*2;
  c.x=p.dot(p)-q.dot(q);  
  c.y=p.dot(p)-r.dot(r);
  circle res;
  res.p.x=a.y*c.y-b.y*c.x;
  res.p.y=b.x*c.x-a.x*c.y;
  res.p=res.p/a.cross(b);
  return circle(res.p, p.dist(res.p));
}

int main(void){
  int n;
  cin >> n;
  while(n--){
    vector<Point>v(3);
    for(int i=0;i<3;i++)
      cin >> v[i].x >> v[i].y;

    circle res=circumscribedCircle(v[0],v[1],v[2]);
    printf("%.3f %.3f %.3f",res.p.x,res.p.y,res.r);
    cout << endl;
  }
  
  return 0;
}

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

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

	for(int i=0;i<n;i++)
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		double a1 = 2*(x2 - x1);
		double b1 = 2*(y2 - y1);
		double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;

		double a2 = 2*(x3 -x1);
		double b2 = 2*(y3 - y1);
		double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;

		double x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
		double y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);

		double r_2 = (x1 - x)*(x1 - x) + (y1 - y)*(y1 - y);
		double r = sqrt(r_2);

		printf("%.3lf %.3lf %.3lf\n",x,y,r);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;

void sol(){
    double x1,y1,x2,y2,x3,y3;
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
    double a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    double b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
    double c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    double s=(a+b+c)/2;
    double ss=sqrt(s*(s-a)*(s-b)*(s-c));
    double sina=2*ss/b/c;
    double r=a/sina/2;
    a*=a;
    b*=b;
    c*=c;
    double px=(a*(b+c-a)*x3+b*(a+c-b)*x2+c*(a+b-c)*x1)/16/(ss*ss);
    double py=(a*(b+c-a)*y3+b*(a+c-b)*y2+c*(a+b-c)*y1)/16/(ss*ss);
    printf("%.3lf %.3lf %.3lf\n",px,py,r);

}

int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        sol();
    }
    return 0;
}