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++: #include <bits/stdc++.h>

using namespace std;

#define EPS (1e-10)
#define equals(a, b) (fabs(a - b) < EPS)

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}

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

    Point operator - (const Point &p) const {
        return Point(x - p.x, y - p.y);
    }
    
    Point operator * (const double &k) const {
        return Point(x * k, y * k);
    }
};

double dot(const Point &a, const Point &b)
{
    return a.x * b.x + a.y * b.y;
}

double norm(const Point &p)
{
    return dot(p, p);
} 

double abs(const Point &p)
{
    return sqrt(norm(p));
}

typedef vector<Point> Polygon;

struct Circle {
    Point p;
    double r;
    Circle(Point p, double r) : p(p), r(r) {}
};

bool check(const Polygon &pg, const Point &p)
{
    double r = abs(pg[0] - p);
    for (int i = 1; i < 3; i++) {
        if (!equals(r, abs(pg[i] - p))) return 0;
    }
    return 1;
}

Circle smallest_enclosing_circle(const Polygon &pg)
{    
    Point p(0, 0);
    int N = 3;
    for (int i = 0; i < (int)pg.size(); i++) {
	p = p + pg[i];
    }
    p = p * (1. / pg.size());
    double d = 0.5;
    while (!check(pg, p)) {
	for (int i = 0; i < 150; i++) {
	    int s = 0;
	    for (int j = 0; j < N; j++) {
		if (abs(pg[s] - p) - abs(pg[j] - p) < -EPS) {
		    s = j;
		}
	    }
	    p = p + (pg[s] - p) * d;
	}
	d *= 0.5;
    }
    double r = abs(p - pg[0]);
    return Circle(p, r);
}

int main()
{
    Polygon pg(3);
    int N;
    cin >> N;
    while (N--) {
        for (int i = 0; i < 3; i++) {
            cin >> pg[i].x >> pg[i].y;
        }
        auto c = smallest_enclosing_circle(pg);
        printf("%.3f %.3f %.3f\n", c.p.x, c.p.y, c.r);
    }
    return 0;
}

C++: #include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
using namespace std;

int main(){
	int n;
	double xa, ya, xb, yb, xc, yc;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> xa >> ya >> xb >> yb >> xc >> yc;
		double a, b, c;
		a = (xb - xc) * (xb - xc) + (yb - yc) * (yb - yc);
		b = (xc - xa) * (xc - xa) + (yc - ya) * (yc - ya);
		c = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb);
		double px, py, r;
		px = a * (b + c - a) * xa + b * (c + a - b) * xb + c * (a + b - c) * xc;
		py = a * (b + c - a) * ya + b * (c + a - b) * yb + c * (a + b - c) * yc;
		px /= a * (b + c - a) + b * (c + a - b) + c * (a + b - c);
		py /= a * (b + c - a) + b * (c + a - b) + c * (a + b - c);
		a = sqrt(a);
		b = sqrt(b);
		c = sqrt(c);
		r = a * b * c / sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c));
		cout << fixed << setprecision(3) << px << ' ' << py << ' ' << r << endl;
	}
	return 0;
}

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

double a,b,c,d,e,f,x,y,r;
int n;

double ifof(double a){
	int n = a*10000;
	if(n%10 >= 5)
		n+=10;
	else if(n%10 <= -5)
		n-=10;
	return n/10000.0;
}

double solvex(){
	double k,l;
	k = ((f-d)*(c*c-a*a+d*d-b*b))-((d-b)*(e*e-c*c+f*f-d*d));
	l = (2*(((f-d)*(c-a))-((b-d)*(e-c))));
	return k/l;
}

double solvey(){
	double k,l;
	k = (e*e-c*c+f*f-d*d-2*(e-c)*x);
	l = (2*(f-d));
	return k/l;
}

int main(){
	std::cin >> n;
	for(int i=0; i<n; i++){
		std::cin >> a >> b >> c >> d >> e >> f;
		x = solvex();
		y = solvey();
		r = std::sqrt(((x-a)*(x-a)) + ((y-b)*(y-b)));
		std::printf("%.3f %.3f %.3f\n",ifof(x),ifof(y),ifof(r));
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
//#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
//#include <stack>
//#include <limits>
#include <sstream>
//#include <functional>
#include <complex>
using namespace std;

#define len(array)  (sizeof (array) / sizeof *(array))
#define rep(i, s, e) for(int i = s;i < e;i++)
#define rrep(i, e, s) for(int i = e;s <= i;i--)
#define vrange(v) v.begin(), v.end()
#define vrrange(v) v.rbegin(), v.rend()
#define vsort(v) sort(vrange(v))
#define vrsort(v) sort(vrrange(v))
#define arange(a) a, a + len(a)
#define asort(a) sort(arange(a))
#define arsort(a, t) sort(arange(a), greater<t>())
#define afill(a, v) fill(arange(a), v)
#define afill2(a, v, t) fill((t *)a, (t *)(a + len(a)), v)
#define fmax(a, b) (a < b? b : a)
#define fmin(a, b) (a > b? b : a)
#define fabs(a) (a < 0? -a : a)
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-10;
//const int dx[] = {1, -1, 0, 0, 1, -1, -1, 1};
//const int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};
//const int weight[] = {0,1,10,100,1000,10000,100000,1000000,10000000};
//priority_queue< int, vector<int>, greater<int> > q;


// http://d.hatena.ne.jp/otaks/20100929

typedef complex<double> p;
//XY座標
#define X real()
#define Y imag()

// 三角形クラス
class Triangle{

private:
  //三角形の3点の座標
  p a, b, c;
  //三角形の3辺の長さ
  double ab, bc, ca;
  //三角形の3角の大きさ(ラジアン)
  double A, B, C;


public:
  //コンストラクタ(3つの点と辺と角度を初期化)
  Triangle(p p1, p p2, p p3){
	a = p1;
	b = p2;
	c = p3;
	ca = abs(c-a);
	bc = abs(b-c);
	ab = abs(a-b);
	A = LawOfCosines(bc,ca,ab);
	B = LawOfCosines(ca,ab,bc);
	C = LawOfCosines(ab,bc,ca);
  }

  //余弦定理から3つの角度を求める関数
  double LawOfCosines(double a,double b, double c){
	return acos( (b*b+c*c-a*a) / (2.0*b*c) );
  }
  //2つのdouble型の数値が等しいかどうか
  bool equal(double a, double b){
	return (abs( a-b ) < EPS)? true : false ;
  }

  //double circumscribedCircleRadius(){//外接円の半径を返す
  double getCR(){
	return ( bc / (2*sin(A)));
  }
  //p circumscribedCircle(){//外心(外接円の中心)の座標を返す
  p getCC(){ // get a circumcenter
	double sA = sin(2.0*A);
	double sB = sin(2.0*B);
	double sC = sin(2.0*C);
	double deno = sA + sB + sC;
	return p((a.X * sA + b.X * sB + c.X * sC) / deno, (a.Y * sA + b.Y * sB + c.Y * sC) / deno );
  }
};

void doIt(){
  int n;
  double x1, y1, x2, y2, x3, y3, px, py, r;
  cin >> n;
  while(n--){
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	Triangle t = Triangle(p(x1, y1), p(x2, y2), p(x3, y3));
	p cc = t.getCC();
	printf("%.3f %.3f %.3f\n", cc.X, cc.Y, t.getCR());
  }
}

int main() {
  doIt();
  return 0;
}