Go: package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n := r.nextInt()

	type Vec struct {
		x, y float64
	}
	vec := func(a, b Vec) Vec { return Vec{b.x - a.x, b.y - a.y} }
	unv := func(a Vec) Vec { return Vec{-a.y, a.x} }
	cdot := func(a, b Vec) float64 { return a.x*b.x + a.y*b.y }
	times := func(t float64, a Vec) Vec { return Vec{t * a.x, t * a.y} }
	add := func(a, b Vec) Vec { return Vec{a.x + b.x, a.y + b.y} }
	for i := 0; i < n; i++ {

		r.Scan(true)
		nextFloat64 := func() (ret float64) { fmt.Sscanf(r.nextString(), "%f", &ret); return }
		a1, a2, a3 := Vec{nextFloat64(), nextFloat64()}, Vec{nextFloat64(), nextFloat64()}, Vec{nextFloat64(), nextFloat64()}
		unv23 := unv(vec(a2, a3))
		v12 := vec(a1, a2)
		v31 := vec(a3, a1)
		s := cdot(v12, v31) / 2 / cdot(v12, unv23)
		c := add(times(.5, add(a2, a3)), times(s, unv23))
		v1c := vec(a1, c)
		fmt.Fprintf(stdout, "%.3f %.3f %.3f\n", c.x, c.y, math.Sqrt(v1c.x*v1c.x+v1c.y*v1c.y))
	}
}

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;
  double cosA, cosB, cosC, sinA, sinB, sinC;

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);
	cosA = getCosine(p2 - p1, p3 - p1);
	cosB = getCosine(p1 - p2, p3 - p2);
	cosC = getCosine(p1 - p3, p2 - p3);
	sinA = getSine(p2 - p1, p3 - p1);
	sinB = getSine(p1 - p2, p3 - p2);
	sinC = getSine(p1 - p3, p2 - p3);
  }

  //3点が一直線上だったら三角形ではない
  bool isTriangle(){
	double t = det(a - c, b - c);
	return abs(t) < EPS? false : true;
  }

  //p1とp2の外積
  double dot(p p1, p p2){
	return p1.X*p2.X + p1.Y*p2.Y;
  }

  //p1とp2の外積
  double det(p p1, p p2){
	return p1.X*p2.Y - p2.X*p1.Y;
  }

  //余弦定理からcosを求める関数
  double LawOfCosines(double a,double b, double c){
	return (b*b+c*c-a*a) / (2.0*b*c);
  }
  //外積からsineを求める
  double getSine(p p1, p p2){
	return abs(det(p1, p2) / (abs(p1)*abs(p2)));
  }
  //内積からcosineを求める
  double getCosine(p p1, p p2){
	return dot(p1, p2) / (abs(p1)*abs(p2));
  }
  //2つのdouble型の数値が等しいかどうか
  bool equal(double a, double b){
	return (abs( a-b ) < EPS)? true : false ;
  }

  //double circumscribedCircleRadius(){//外接円の半径を返す
  double getCR(){
	//return ( bc / (2*sin(A)));
	return ( bc / (2*sinA));
  }
  //p circumscribedCircle(){//外心(外接円の中心)の座標を返す
  p getCC(){ // get a circumcenter
	double sA = 2*sinA*cosA;
	double sB = 2*sinB*cosB;
	double sC = 2*sinC*cosC;
	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 );
  }
};


//AOJ0010
void aoj0010(){
  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());
  }
}

void doIt(){
  Triangle t = Triangle(p(0, 1), p(1, 2), p(2, 3));
  cout << t.isTriangle() << endl;
}

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

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
	int a,b,c,d,e,f,g;
	double A,B,C,D,E,F,G,H,I,L,M,N,O,P,Q,R,J,K,X,Y;
	scanf("%d",&a);
	
	for(b=0;b<a;b++){
		scanf("%lf %lf %lf %lf %lf %lf",&A,&B,&C,&D,&E,&F);
		G=-2.0*A*D+2.0*C*D+2.0*A*F-2.0*C*F+2.0*B*C-2.0*B*E-2.0*C*D+2.0*E*D;
		H=D-F;
		I=B+D;
		J=B-D;
		K=B-D;
		L=D+F;
		M=D-F;
		O=-H*I*J+K*L*M-A*A*D+A*D*C+A*A*F-A*C*F-A*C*D+C*C*D+A*C*F-C*C*F+B*C*C-B*C*E-C*C*D+E*C*D+B*C*E-B*E*E-C*E*D+E*E*D;
		X=O/G;
		if(G==0.0)X=0.0;
		//if(O==0.0)X=0.0;
		
		H=-2*F+2*D;
		I=C-X;
		I=I*I;
		J=E-X;
		J=J*J;
		I=I-J;
		I=I+D*D-F*F;
		Y=I/H;
		//if(H==0.0)Y=0.0;
		
		H=X-A;
		I=Y-B;
		H=H*H;
		I=I*I;
		H=H+I;
		R=sqrt(H);
		
		
		
		
		
	}
	printf("%.3lf %.3lf %.3lf\n",X,Y,R);
	return 0;
}