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++: /*
NOTE :
*min_element(.begin(),.end())
*max_element(.begin(),.end())
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define MAX 100
#define INF 1<<20
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;
/////
template <class T>
void printMartix(valarray<valarray<T> > &A)
{
  int n = A.size();
  int m = A[0].size();
  REP(i,n){{REP(j,n) cout << A[i][j] << " ";} cout << endl;}
  cout << endl;
}

template <class T>
void printArray(valarray<T> &A)
{
  int n = A.size();
  REP(i,n) cout << A[i] << " ";
  cout << endl << endl;
}

template <class T>
bool solution(valarray<valarray<T> > &A, valarray<T> &b)
{
  int n = A.size();
  REP(i,n)
  {
    T a;
    //printMartix(A);
    //printArray(b);
    REP2(u,i,n)
    {
      a = A[u][i];
      if(a == 0) continue;
      else
      {
        if(u != i)
        {
          swap(A[i],A[u]);
          swap(b[i],b[u]);
        }
        break;
      }
      if(u == n-1) return false;
    }
    A[i] /= (1.0 * a);
    b[i] /= (1.0 * a);
    REP(j,n)
    {
      if(j == i) continue;
      b[j] -= b[i] * A[j][i];
      A[j] -= A[i] * A[j][i];
    }
    //printMartix(A);
    //printArray(b);
  }
  return true;
}

/////
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int n; cin >> n;
  REP(u,n)
  {
    double x[3], y[3]; REP(i,3) cin >> x[i] >> y[i];
    valarray<valarray<double> > A(valarray<double>(0.0,3),3);
    valarray<double> b(0.0,3);
    REP(i,3)
    {
      A[i][0] = x[i];
      A[i][1] = y[i];
      A[i][2] = 1;
      b[i] = -(x[i]*x[i] + y[i]*y[i]);
    }
    if(solution(A,b))
    {
      double cx = -b[0] * 0.5;
      double cy = -b[1] * 0.5;
      double r = sqrt((x[0]-cx)*(x[0]-cx)+(y[0]-cy)*(y[0]-cy));
      printf("%.3lf %.3lf %.3lf\n",cx,cy,r);
    }
    //else cout << "no solution" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<double, double> P;
typedef pair<double,P> dP;

dP calc_eq (double xa, double ya, double xb, double yb )
{
	double a = (xb - xa );
	double b = (yb - ya );
	double c = (xb - xa)*(xb + xa )/2. + (yb - ya)*(yb+ya )/2.;

	return dP (a, P (b, c ) );		
}

double calc_radius (double xa, double ya, double xb, double yb )
{
	double res = (xa - xb)*(xa - xb) + (ya - yb)*(ya - yb );

	return sqrt (res );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.CCT", "r", stdin );
	int n;
	cin >> n;
	rep (i, n ){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		dP l1 = calc_eq (x1, y1, x2, y2 );
		dP l2 = calc_eq (x1, y1, x3, y3 );

		double a = l1.first, b = l1.second.first, c = l1.second.second;
		double d = l2.first, e = l2.second.first, f = l2.second.second;
/*
		cerr << "a: " << a << " b: " << b << " c: " << c << endl;
		cerr << "d: " << d << " e: " << e << " f: " << f << endl;
*/
		double x = 0.0, y = 0.0, r = 0.0;
		x = (c*e - b*f)/(a*e - b*d);
		y = (c*d - a*f)/(b*d - a*e);
		r = calc_radius (x, y, x1, y1 );

		if (fabs(x) < 1.0e-3){
			x = 0.0;
		} // end if
		if (fabs(y) < 1.0e-3){
			y = 0.0;
		} // end if

		printf ("%.3f %.3f %.3f\n", x, y, r );

	} // end loop
		
	return 0;
}