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<vector>
#include<math.h>
#include<iomanip>
using namespace std;

int main() {
	double A1, A2, A3, B1, B2, B3, C1=1, C2=1, C3=1, E1, E2, E3, x, y, z, n;
	vector<double> X, Y, Z;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A1 >> B1 >> A2 >> B2 >> A3 >> B3;
		E1 = -A1*A1 - B1*B1;
		E2 = -A2*A2 - B2*B2;
		E3 = -A3*A3 - B3*B3;
		x = (E1*B2*C3 + E2*B3*C1 + E3*B1*C2 - E1*B3*C2 - E2*B1*C3 - E3*B2*C1) / (A1*B2*C3 + A2*B3*C1 + A3*B1*C2 - A1*B3*C2 - A2*B1*C3 - A3*B2*C1);
		y = (A1*E2*C3 + A2*E3*C1 + A3*E1*C2 - A1*E3*C2 - A2*E1*C3 - A3*E2*C1) / (A1*B2*C3 + A2*B3*C1 + A3*B1*C2 - A1*B3*C2 - A2*B1*C3 - A3*B2*C1);
		z = (A1*B2*E3 + A2*B3*E1 + A3*B1*E2 - A1*B3*E2 - A2*B1*E3 - A3*B2*E1) / (A1*B2*C3 + A2*B3*C1 + A3*B1*C2 - A1*B3*C2 - A2*B1*C3 - A3*B2*C1);
		double xr, yr, r;
		xr = -x / 2; yr = -y / 2; r = sqrt((x*x + y*y) / 4 - z);
		xr *= 1000; yr *= 1000; r *= 1000;
		if (xr >= 0)xr += 0.5;
		else xr -= 0.5;
		xr = int(xr);
		xr /= 1000;
		if (yr >= 0)yr += 0.5;
		else yr -= 0.5;
		yr = int(yr);
		yr /= 1000;
		r += 0.5;
		r = int(r);
		r /= 1000;
		X.push_back(xr);
		Y.push_back(yr);
		Z.push_back(r);
	}
	for (int i = 0; i < n; i++) {
		cout << fixed << setprecision(3) << X[i] << " " << Y[i] << " " << Z[i] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>


#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


double A[2][2];
double C[2];


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

		double x21 = x2 - x1;
		double x31 = x3 - x1;
		double y21 = y2 - y1;
		double y31 = y3 - y1;

		double xc = ((y31*(x21*x21 + y21*y21)) - (y21*(x31*x31 + y31*y31))) /
			(2 * (x21*y31 - y21*x31));

		double yc = ((x21*(x31*x31 + y31*y31)) - (x31*(x21*x21 + y21*y21))) /
			(2 * (x21*y31 - y21*x31));	
		
		double d = (xc - x1)*(xc - x1) + (yc - y1)*(yc - y1);
		d = sqrt(d);
		xc = xc * 1000;
		yc = yc * 1000;
		d = d * 1000;
		yc += 0.5;
		xc += 0.5;
		d += 0.5;

		yc = floor(yc);
		xc = floor(xc);
		d = floor(d);

		printf("%.3lf %.3lf %.3lf\n", xc / 1000, yc / 1000, d / 1000);
	}

}

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 = (x1*l + y1*m) - (pw(x1) + pw(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<iostream>
#include<cmath>
#include<cstdio>

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

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

double middle(double m, double n, double o){
	using std::max;
	using std::min;
	return (max(m,max(n,o))+min(m,min(n,o)))/2;
}

int main(){
	std::cin >> a >> b >> c >> d >> e >> f;
	x = middle(a,c,e);
	y = middle(b,d,f);
	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 <cstdio>
#include <cmath>

using namespace std;

#define SQ(x) ((x) * (x))

double ix[4], iy[4], x[4], y[4], a[4], b[4], c[4];

void equation(double x1, double y1, double x2, double y2, double *equa, double *equb)
{
  if(x1 == x2){
    //    puts("x1 == x2");
    *equb = 0;
    return;
  }
  if(y1 == y2){
    //    puts("y1 == y2");
    *equa = 0;
    return;
  }

  *equa = (y1 - y2) / (x1 - x2);
  return;
}

void line(double cx, double cy, double *equa, double *equb, double *equc)
{
  //  printf("%lf %lf %lf %lf %lf\n", cx, cy, *equa, *equb, *equc);
  if(*equa == 0){
    *equa = 1;
    *equb = 0;
    *equc = cx;
    //    printf("x = %lf\n", *equc);
    return;
  }
  if(*equb == 0){
    *equa = 0;
    *equb = 1;
    *equc = cy;
    //    printf("y = %lf\n", *equc);
    return;
  }

  *equa = -1 / *equa;
  *equc = cy - (*equa) * cx;
  return;
}

double dist(double x1, double y1, double x2, double y2)
{
  return sqrt(SQ(x1-x2) + SQ(y1-y2));
}

void point(double a1, double b1, double c1, double a2, double b2, double c2, double *rx, double *ry)
{
  if(!a1 || !b1 || !a2 || !b2 ){
    if(!a1 && !b2){
      //      puts("a1 b2");
      *rx = c2;
      *ry = c1;
      return;
    }
    if(!b1 && !a2){
      //      puts("b1 a2");
      *rx = c1;
      *ry = c2;
      return;
    }

    if(!a1){
      //      puts("a1");
      *ry = c1;
      *rx = ((*ry) - c2) / a2;
      return;
    }
    if(!a2){
      //      puts("a2");
      *ry = c2;
      *rx = ((*ry) - c1) / a1;
      return;
    }
    /*    if(!a1 || !a2){
      puts("a");
      double aa = (a1 * b2) - (a2 * b1);
      double cc = (c1 * b2) - (c2 * b1);
      *rx = -(cc / aa);
      *ry = a1 * (*rx) + c1;
      return;
      }*/

    if(!b1){
      //      puts("b1");
      *ry = (a2 * c1 + c2) / b2;
      *rx = c1;
      return ;
    }
    if(!b2){
      //      puts("b2");
      *ry = (a1 * c2 + c1) / b1;
      *rx = c2;
      return;
    }
    /*    if(!b1 || !b2){
      puts("b");
      double bb = (b1 * a2) - (b2 * a1);
      double cc = (c1 * a2) - (c2 * a1);
      *ry = cc / bb;
      *rx = ((*ry) * b1 - c1) / a1;
      return;
      }*/

    fprintf(stderr, "error\n");
    return;
  }

  double bb = (b1 * a2) - (b2 * a1);
  double cc = (c1 * a2) - (c2 * a1);
  *ry = cc / bb;
  *rx = ((*ry) * b1 - c1) / a1;
  return;
}

int main()
{
  int n;
  scanf("%d", &n);
  while(n--){
    for(int i=0;i<3;i++)
      scanf("%lf%lf", &ix[i], &iy[i]);
    //    printf("%lf %lf %lf %lf %lf %lf\n", ix[0], ix[1], ix[2], iy[0], iy[1], iy[2]);    
    a[0] = a[1] = b[0] = b[1] = 1;
    c[0] = c[1] = 0;
    equation(ix[0], iy[0], ix[1], iy[1], &a[0], &b[0]);
    equation(ix[1], iy[1], ix[2], iy[2], &a[1], &b[1]);

    //    printf("傾き %lf %lf %lf %lf\n", a[0], b[0], a[1], b[1]);


    line((ix[0]+ix[1])/2, (iy[0]+iy[1])/2, &a[0], &b[0], &c[0]);
    line((ix[1]+ix[2])/2, (iy[1]+iy[2])/2, &a[1], &b[1], &c[1]);

    //    printf("line %lf %lf %lf %lf %lf %lf\n", a[0], b[0], c[0], a[1], b[1], c[1]);
    
    double resx, resy;
    point(a[0], b[0], c[0], a[1], b[1], c[1], &resx, &resy);

    printf("%.3lf %.3lf %.3lf\n", resx, resy, dist(resx, resy, ix[0], iy[0]));
    //    printf("%lf %lf\n", dist(resx, resy, ix[1], iy[1]), dist(resx, resy, ix[2], iy[2]));
  }
  return 0;
}