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 <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
    double x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double x,y,r;
    double a,b,c,d,e,f;
    a=2*x1-2*x2;
    b=2*y1-2*y2;
    c=x1*x1-x2*x2+y1*y1-y2*y2;
    d=2*x2-2*x3;
    e=2*y2-2*y3;
    f=x2*x2-x3*x3+y2*y2-y3*y3;
    y=(a*f-c*d)/(a*e-b*d);
    x=(c-b*y)/a;
    r=sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));
    printf("%.3f %.3f %.3f\n",x,y,r);
    }
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main(void){
  int n;
  double x1, y1, x2, y2, x3, y3;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double xp1 = x1 - x3, yp1 = y1 - y3, xp2 = x2 - x3, yp2 = y2 - y3;
    double A, B, C;
    double cx, cy, r;
    A = (xp1 / yp1 - xp2 / yp2);
    B = (xp1 * xp1 / yp1 + yp1) / 2;
    C = (xp2 * xp2 / yp2 + yp2) / 2;
    cx = (B - C) / A;
    cy = (xp1 * xp1 / yp1 + yp1) / 2 - cx * xp1 / yp1;
    cx += x3; cy += y3;
    r = hypot(cx - x1, cy - y1);
    printf("%.3lf %.3lf %.3lf\n", cx, cy, r);
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,x1_2,x1_3,y1_2,y1_3,z1_2,z1_3,a,b,c,r;
	while(cin >> n){
		for(int i = 0;i < n;++i){
			cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
			z1_2 = (((x1 * x1) + (y1 * y1)) * -1) - (((x2 * x2) + (y2 * y2)) * -1);
			z1_3 = (((x1 * x1) + (y1 * y1)) * -1) - (((x3 * x3) + (y3 * y3)) * -1);
			x1_2 = x1 - x2;
			x1_3 = x1 - x3;
			y1_2 = y1 - y2;
			y1_3 = y1 - y3;
			a = ((y1_2 * z1_3) - (y1_3 * z1_2)) / ((y1_2 * x1_3) - (y1_3 * x1_2)) * -1;
			b = ((x1_2 * z1_3) - (x1_3 * z1_2)) / ((x1_2 * y1_3) - (x1_3 * y1_2)) * -1;
			c = ((x1 * x1) + (y1 * y1) + (a * x1) + (b * y1)) * -1;
			r = sqrt(c * 4 + (a * a) + (b * b));
			printf("%.3f %.3f %.3f\n",a / 2.0,b / 2.0,r);
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){

int n;
float x[3],y[3],detA,a,b,px,py,r;

scanf("%d",&n);

LOOP(i,n){
	scanf("%f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);

	detA=(x[0]-x[1])*(y[1]-y[2])-(x[1]-x[2])*(y[0]-y[1]);
	a=x[0]*x[0]-x[1]*x[1]+y[0]*y[0]-y[1]*y[1];
	b=x[1]*x[1]-x[2]*x[2]+y[1]*y[1]-y[2]*y[2];
	
	px=0.5/detA*((y[1]-y[2])*a-(y[0]-y[1])*b);
	py=0.5/detA*(-(x[1]-x[2])*a+(x[0]-x[1])*b);
	r=sqrt((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0]));

	printf("%.3f %.3f %.3f\n",px,py,r);
}
return 0;		
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
using namespace std;

#define x real()
#define y imag()
typedef complex<double> Point;

Point circumscribed_Circle_Center(Point a, Point b, Point c){
  double A = a.x - b.x;
  double B = a.y - b.y;
  double C = -1 * (a.x*a.x - c.x*c.x + a.y*a.y - b.y*b.y);
  double D = a.x - c.x;
  double E = a.y - c.y;
  double F = -1 * (a.x*a.x - c.x*c.x + a.y*a.y - c.y*c.y);

  double L = (C*E - B*F) / (E*A - B*D);
  double M = (D*C - A*F) / (D*B - E*A);
  double xp = L / -2.0;
  double yp = M / -2.0;
  return (Point(xp, yp));
}

double circumscribed_Circle_Radius(Point a, Point b, Point c){
  double A = a.x - b.x;
  double B = a.y - b.y;
  double C = -1 * (a.x*a.x - c.x*c.x + a.y*a.y - b.y*b.y);
  double D = a.x - c.x;
  double E = a.y - c.y;
  double F = -1 * (a.x*a.x - c.x*c.x + a.y*a.y - c.y*c.y);

  double L = (C*E - B*F) / (E*A - B*D);
  double M = (D*C - A*F) / (D*B - E*A);

  double N = -1 * (a.x*a.x + a.y*a.y + L*a.x + M*a.y);
  double r = sqrt(L*L + M*M - 4*N) / 2.0;
  return r;
}

int main(){
  int n;
  Point a, b, c;
  cin >> n;
  while(n--){
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
    Point C = circumscribed_Circle_Center(a, b, c);
    double r = circumscribed_Circle_Radius(a, b, c);
    printf("%0.3f %0.3f %0.3f\n", C.x, C.y, r);
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
  int n;
  double x1, y1, x2, y2, x3, y3;
  cin >> n;
  REP(i, n){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double a = 2 * (x2 - x1);
    double b = 2 * (y2 - y1);
    double e = x2 * x2 + y2 * y2 - x1 * x1 - y1 * y1;
    double c = 2 * (x3 - x2);
    double d = 2 * (y3 - y2);
    double f = x3 * x3 + y3 * y3 - x2 * x2 - y2 * y2;

    double D = 1 / (a * d - b * c);
    double x = (d * e - b * f) * D;
    double y = (-c * e + a * f) * D;
    double r = sqrt(SQ(x1 - x) + SQ(x1 - y));
    printf("%.3f %.3f %.3f\n", x, y, r);
  }
}

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

void gradcut(double *a,double *b,double x1,double y1,double x2,double y2);

int main() {
    double x[3],y[3],a[2],b[2],rx,ry,r;
    int n;
    std::cin >> n;
    for(int j=0;j<n;j++){
        int am=0,add=1;;
        for(int i=0;i<3;i++) std::cin >> x[i] >> y[i];
        for(int i=0;i<3;i++){
            if(i==2) add=-2;
            if(x[i]!=x[i+add]&&y[i]!=y[i+add]){
                gradcut(&a[am],&b[am],x[i],x[i+add],y[i],y[i+add]);
                am++;
                if(am>2) break;
            }else if(x[i]==x[i+add]){
                a[am]=0;
                b[am]=(y[i]+y[i+add])/2;
                am++;
                if(am>2) break;
            }
        }


        rx = (b[1]-b[0])/(a[0]-a[1]);
        ry = a[0]*rx+b[0];
        r=sqrt((x[0]-rx)*(x[0]-rx)+(y[0]-ry)*(y[0]-ry));
        printf("%.3f %.3f %.3f",rx,ry,r);
    }
    return 0;
}

void gradcut(double *a,double *b,double x1,double x2,double y1,double y2){

    *a=(y2-y1)/(x2-x1);
    *b=y1-*a*x1;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>

using namespace std;

double radius(vector<double> center, vector<double> xy){
    double x, y;
    x = xy[0] - center[0];
    y = xy[1] - center[1];
    return sqrt(pow(x,2) + pow(y,2));    
}

vector<double> center(vector<double> coo){
    double a1, b1, c1, a2, b2, c2, x, y;
    a1 = 2 * (coo[2] - coo[0]);
    b1 = 2 * (coo[3] - coo[1]);
    c1 = pow(coo[0],2) - pow(coo[2],2) + pow(coo[1],2) - pow(coo[3],2); 
    
    a2 = 2 * (coo[4] - coo[0]);
    b2 = 2 * (coo[5] - coo[1]);
    c2 = pow(coo[0],2) - pow(coo[4],2) + pow(coo[1],2) - pow(coo[5],2);
    
    x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
    y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
    
    vector<double> cent = {x,y};
    double rad = radius(cent, coo);
    return {x,y, rad};
    
}



int main(){
    int n;
    vector<double> v = {0,0,0,0,0,0};
    cin >> n;
    while(cin >> v[0] >> v[1] >> v[2] >> v[3] >> v[4] >> v[5]){
        vector<double> c = center(v);
        cout << fixed << setprecision(3) << c[0] << " " << c[1] << " " << c[2] << endl;
    }
}