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 <iomanip>
#include <cmath>

using namespace std;

int main() {
  int datasetnum;
  double x1,y1,x2,y2,x3,y3;

  cin >> datasetnum;

  for (int loopcount = 0; loopcount < datasetnum; loopcount++) {
    double px,py,r;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    double len_1 = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
    double len_2 = sqrt(pow(x1-x3,2)+pow(y1-y3,2));
    double len_3 = sqrt(pow(x2-x1,2)+pow(y2-y1,2));

    double s = (len_1+len_2+len_3)/2;
    double area = sqrt(s*(s-len_1)*(s-len_2)*(s-len_3));

    double sin_1 = 2*area/(len_2*len_3);

    r = len_1/(2*sin_1);

    double a = x1 - x3;
    double b = y1 - y3;
    double c = pow(x1,2)-pow(x3,2)+pow(y1,2)-pow(y3,2);
    double d = x2 - x3;
    double e = y2 - y3;
    double f = pow(x2,2)-pow(x3,2)+pow(y2,2)-pow(y3,2);

    px = (c*e-b*f)/(2*(a*e-b*d));
    py = (c*d-a*f)/(2*(b*d-a*e));

    cout << setprecision(4) << px << " " << py << " " << r << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    double x1,y1,x2,y2,x3,y3;
    int n;
 
    scanf("%d",&n);
 
    double a,b,c;
    double ans = 0;
    double xp,yp;
    for(int i = 0;i < n; i++){
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
 
        a = hypot(x2 - x1,y2 - y1);
        b = hypot(x3 - x1,y3 - y1);
        c = hypot(x3 - x2,y3 - y2);
 
        ans = (a*b*c) / (sqrt((a+b+c)*(b+c-a)*(a-b+c)*(a+b-c)));
        xp = (((x1*x1)+(y1*y1))*(y2-y3)+((x2*x2)+(y2*y2))*(y3-y1)+((x3*x3)+(y3*y3))*(y1-y2))/(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
        yp = (((x1*x1)+(y1*y1))*(x2-x3)+((x2*x2)+(y2*y2))*(x3-x1)+((x3*x3)+(y3*y3))*(x1-x2))/(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2))/2;
        printf("%.3lf %.3lf %.3lf\n",xp,yp,ans);
        ans = 0;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>
#define INF 100000000
using namespace std;
#define pw(a) (a)*(a)

int main(){
  double x1,x2,x3,y1,y2,y3;
  int n;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double a,b,l,m,n;
    a = -1*(pw(x1) - pw(x2) + pw(y1) - pw(y2));
    b = -1*(pw(x1) - pw(x3) + pw(y1) - pw(y3));
    l = (a*(y1-y3)-b*(y1-y2))/((y1-y3)*(x1-x2)-(x1-x3)*(y1-y2));
    m = (b-(x1-x3)*l)/(y1-y3);
    n = -1*(pw(x1) + pw(y1)+ l*x1 + m*y1);
    printf("%.3f %.3f %.3f\n",(float)-l/2,(float)-m/2,(float)sqrt((pw(l) + pw(m) - 4*n))/2);
  }
  return 0;
}

C++: #include<stdio.h>
#include<math.h>
 
int main(void)
{
 double x,y,r;
 double x1,x2,x3,y1,y2,y3;
 double ecm[3][2];
 double a,b,A; //enlarged coefficient matrix:拡大係数行列
 int i;
 int n;
 
 scanf("%d",&n);
 for(i = 0; i < n; i++)
 {
  scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
  ecm[0][0] = x1 - x2;
  ecm[0][1] = y1 - y2;
  ecm[0][2] = (x2*x2 + y2*y2) - (x1*x1 + y1*y1);
  ecm[1][0] = x1 - x3;
  ecm[1][1] = y1 - y3;
  ecm[1][2] = (x3*x3 + y3*y3) - (x1*x1 + y1*y1);
  A = (ecm[0][0]*ecm[1][1])-(ecm[0][1]*ecm[1][0]); 
  a = ((ecm[0][2]*ecm[1][1])-(ecm[0][1]*ecm[1][2]))/A+0;
  b = ((ecm[0][0]*ecm[1][2])-(ecm[0][2]*ecm[1][0]))/A+0;
  x = (a/-2.0);
  y = (b/-2.0);
  r = sqrt(pow(x1-x,2)+pow(y1-y,2));
  printf("%.3f %.3f %.3f\n",x,y,r); //四捨五入は自動的にされる
 }
 return 0;
}

C++: #include <stdio.h>
#include <math.h>

int main(){
	int n;
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		double x1,y1,x2,y2,x3,y3;
		scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);

		double x,y;
		double ax,ay,am,bx,by,bm;


		if(y1==y2){
			x = (x1+x2)/2;
			bx = (x2+x3)/2;
			by = (y2+y3)/2;
			bm = -(x2-x3)/(y2-y3);
			y = bm*(x-bx)+by;
		}else if(y2==y3){
			x = (x2+x3)/2;
			ax = (x1+x2)/2;
			ay = (y1+y2)/2;
			am = -(x1-x2)/(y1-y2);
			y = am*(x-ax)+ay;
		}else{
			ax = (x1+x2)/2;
			ay = (y1+y2)/2;
			am = -(x1-x2)/(y1-y2);	
			bx = (x2+x3)/2;
			by = (y2+y3)/2;
			bm = -(x2-x3)/(y2-y3);

			x = (am*ax-bm*bx-ay+by)/(am-bm);
			y = am*(x-ax)+ay;
		}
		
		printf("%.3lf %.3lf %.3lf\n", x, y, sqrt(pow(x1-x, 2)+pow(y1-y,2)));
	}
}