Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

C++: /* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
// include {{{
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <vector>
#include <complex>
#include <iostream>
#include <algorithm>

using namespace std;

// }}}
/* cpp template {{{*/


#define endl '\n'
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;      // ??§?¨?????????????double???long double?????????
typedef long long ll;
typedef long double lb;
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y, int x, int H, int W){return (y >= 0 && x >= 0 && y < H && x < W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}

/* ?????° */
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


/* }}} */

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // ???????????????
  return a1 + d1/d2 * (a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int x = in();
  
  for (int i = 0; i < x; i++){
    D a1, a2, b1, b2, c1, c2;
    cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2;
    P p = circumcenter( P(a1, a2), P(b1, b2), P(c1, c2));
    D r = sqrt(pow(a1 - p.X, 2) + pow(a2 - p.Y, 2));
    cout << p.X << " " << p.Y << r << endl;
  }
  return (0);
}

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

double marume( double x ){
	long long t = x * 1000 + ((x > 0) ? 1 : -1) * 0.5;
	return t/1000.0;
}

int main(){
	int n;
	double tx, ty, x1, y1, x2, y2;
	
	cin >> n;
	while(n--){
		cin >> tx >> ty >> x1 >> y1 >> x2 >> y2;
		x1 -= tx; y1 -= ty;
		x2 -= tx; y2 -= ty;
		
		double dist1 = x1 * x1 + y1 * y1;
		double dist2 = x2 * x2 + y2 * y2;
		x1 *= 2; y1 *= 2;
		x2 *= 2; y2 *= 2;
		
		double detA = x1 * y2 - y1 * x2;
		double detX = dist1 * y2 - y1 * dist1;
		double detY = x1 * dist2 - dist1 * x2;
		double x = detX / detA; //if(x < 0){ x -= 1e-5; } else { x += 1e-5; }
		double y = detY / detA; //if(y < 0){ y -= 1e-5; } else { y += 1e-5; }
		double r = hypot(x, y) + 1e-7;
		
		x += tx;
		y += ty;
		
		x = marume(x);
		y = marume(y);
		r = marume(r);
		printf("%.3Lf %.3Lf %.3Lf\n", x, y, r);
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<math.h>

using namespace std;

int main()
{
	int n;
	double x1,y1,x2,y2,x3,y3,xp,yp,r;
	double a,b,c,d,e,f,L,M,N;
	
	cin>>n;
	for (int i=0; i<n; i++) {
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		a=x1-x2;
		b=y1-y2;
		c=-1*(x1*x1+y1*y1)+(x2*x2+y2*y2);
		d=x1-x3;
		e=y1-y3;
		f=-1*(x1*x1+y1*y1)+(x3*x3+y3*y3);
		M=(c*d-a*f)/(b*d-a*e);
		L=(c-b*M)/a;
		N=-L*x1-M*y1-x1*x1-y1*y1;
		xp=-1*(L/2);
		yp=-1*(M/2);
		r=sqrt(-1*N+(L*L)/4+(M*M)/4);
	
		printf("%.3f %.3f %.3f\n",xp,yp,r);
	}
	
	return 0;	
}

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

double area(const complex<double> &p0, const complex<double> &p1, const complex<double> &p2) {
    complex<double> _p0 (p0.real() - p1.real(), p0.imag() - p1.imag());
    complex<double> _p1 (p1.real() - p2.real(), p1.imag() - p2.imag());

    double a = (_p0.real() * _p1.imag() - _p0.imag() * _p1.real()) * 0.5;
    return (a > 0) ? a : -a;
}

double dist2(const complex<double> &p0, const complex<double> &p1) {
    return (p0.real() - p1.real()) * (p0.real() - p1.real())
        + (p0.imag() - p1.imag()) * (p0.imag() - p1.imag());
}

int main () {
    int n;
    cin >> n;
    while (n--) {
        complex<double> p[3];
        for (int i = 0; i < 3; i++) {
            double x, y;
            cin >> x >> y;
            p[i] = complex<double> (x, y);
        }

        double d2[3], d[3];
        for (int i = 0; i < 3; i++) {
            d2[i] = dist2(p[(i+1)%3], p[(i+2)%3]);
            d[i] = sqrt(d2[i]);
        }

        double s = area(p[0], p[1], p[2]);
        double ss = s * s * 16;

        double e[3];
        e[0] = d2[0] * (-d2[0] + d2[1] + d2[2]) / ss;
        e[1] = d2[1] * (d2[0] - d2[1] + d2[2]) / ss;
        e[2] = d2[2] * (d2[0] + d2[1] - d2[2]) / ss;

        double x = 0, y = 0;
        for (int i = 0; i < 3; i++) {
            x += e[i] * p[i].real();
            y += e[i] * p[i].imag();
        }
        double r = d[0] * d[1] * d[2] /
            sqrt((d[0]+d[1]+d[2]) * (-d[0]+d[1]+d[2]) * (d[0]-d[1]+d[2]) * (d[0]+d[1]-d[2]));

        printf("%.3f %.3f %.3f\n", x, y, r);
    }
}

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

int main()
{
	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 a1 = 2*(x2 - x1);
		double b1 = 2*(y2 - y1);
		double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;

		double a2 = 2*(x3 -x1);
		double b2 = 2*(y3 - y1);
		double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;

		double x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
		double y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);

		double r_2 = (x1 - x)*(x1 - x) + (y1 - y)*(y1 - y);
		double r = sqrt(r_2);

		cout << x << " " << y << " " << r << endl;
	}

	return 0;
}