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 <sstream>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
  double eps = 10e-7;
  double x1,y1,x2,y2,x3,y3;
  scanf("%lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
  double a = pow(x2-x3,2.0)+pow(y2-y3,2.0);
  double b = pow(x3-x1,2.0)+pow(y3-y1,2.0);
  double c = pow(x1-x2,2.0)+pow(y1-y2,2.0);
  double a2 = sqrt(pow(x2-x3,2.0)+pow(y2-y3,2.0));
  double b2 = sqrt(pow(x3-x1,2.0)+pow(y3-y1,2.0));
  double c2 = sqrt(pow(x1-x2,2.0)+pow(y1-y2,2.0));
  double s = (a2+b2+c2)/2.0;
  double S = sqrt(s*(s-a2)*(s-b2)*(s-c2));
  double px = (a*(b+c-a) * x1 + b*(c+a-b) * x2 + c*(a+b-c) * x3) / (16.0*pow(S,2.0));
  double py = (a*(b+c-a) * y1 + b*(c+a-b) * y2 + c*(a+b-c) * y3) / (16.0*pow(S,2.0));
  double r = a2*b2*c2/(4.0*S);
  px += 0.0005 + eps;
  py += 0.0005 + eps;
  r += 0.0005 + eps;
  printf("%.3f %.3f %.3f\n",px,py,r);
}

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

using namespace std;

long double sisya(long double a) {
	a *= 1000.0;
	if (a-(int)a >= 0.5) {
		a += 1.0;
	}
	a /= 1000.0;
	return a; 
}

double ll(double x1, double y1, double x2, double y2) {
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

double yoge(double a, double b, double c) {
	return (b*b+c*c-a*a)/(2.0*b*c);
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		long double dd[3][2];
		for (int j = 0; j < 3; j++) {
			cin >> dd[j][0] >> dd[j][1];
		}
		long double s[3];
		s[0] = ll(dd[1][0],dd[1][1],dd[2][0],dd[2][1]);
		s[1] = ll(dd[2][0],dd[2][1],dd[0][0],dd[0][1]);
		s[2] = ll(dd[0][0],dd[0][1],dd[1][0],dd[1][1]);
		long double k[3];
		k[0] = acos(yoge(s[0],s[1],s[2]));
		k[1] = acos(yoge(s[1],s[2],s[0]));
		k[2] = acos(yoge(s[2],s[0],s[1]));
		long double X, Y, R;
		X = (dd[0][0]*sin(2.0*k[0])+dd[1][0]*sin(2.0*k[1])+dd[2][0]*sin(2.0*k[2]))/(sin(2.0*k[0])+sin(2.0*k[1])+sin(2.0*k[2]));
		Y = (dd[0][1]*sin(2.0*k[0])+dd[1][1]*sin(2.0*k[1])+dd[2][1]*sin(2.0*k[2]))/(sin(2.0*k[0])+sin(2.0*k[1])+sin(2.0*k[2]));
		R = s[0]/(2.0*sin(k[0]));
		printf("%.3f %.3f %.3f\n", X, Y, R);
	}
	return 0;
}

C++: #include"iostream"
#include"cstdio"
#include"cmath"

using namespace std;

int main()
{
	int n;
	double x1, y1, x2, y2, x3, y3;
	double x, y, r;

	cin >> n;
	while (n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double t1 = x1*x1 + y1*y1;
		double t2 = x2*x2 + y2*y2;
		double t3 = x3*x3 + y3*y3;
		double temp = x1*y2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 - x3*y2;
		double x = (t2*y3 + t1*y2 + t3*y1 - t2*y1 - t3*y2 - t1*y3) / temp / 2;
		double y = (t3*x2 + t2*x1 + t1*x3 - t1*x2 - t2*x3 - t3*x1) / temp / 2;
		r = sqrt((x1 - x)*(x1 - x) + (y1 - y)*(y1 - y));
		printf("%.3lf %.3lf %.3lf", x, y, r);
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
using lint = long long;
#define low lower_bound
#define upp upper_bound
#define rep(i, n) for (lint i = 0; i < lint(n); ++i)
#define Rep(i, n) for (lint i = lint(n); i >= 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { lint to; lint cost; };
using P = pair<lint, lint>;
using D = pair<double, double>;
//const lint mod = 998244353LL;
const lint mod = 1000000007LL;
const lint inf = 3LL * mod * mod;
const double Pi = acos(-1.0);

template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmin(T& a, T b) {
	return chmax(b, a);
}

lint modpow(lint x, lint n, lint m) {
	lint ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (m <= ans) ans %= m;
		}
		x *= x;
		if (m <= x) x %= m;
		n >>= 1;
	}
	return ans;
}

lint fact[1000000];
void f_init(lint n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

lint comb(lint n, lint r) {
	if (n < r) return 0;
	if (n == r) return 1;
	lint ans = fact[n] * modpow(fact[n - r], mod - 2, mod) % mod * modpow(fact[r], mod - 2, mod) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

lint nck[1010][1010];
void comb(lint n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

lint gcd(lint a, lint b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

lint lcm(lint a, lint b) { return a / gcd(a, b) * b; }

bool pri(lint p) {
	for (lint i = 2; i * i <= p; i == 2 ? ++i : i += 2) if (p % i == 0) return false;
	return p > 1;
}

map<lint, lint> factring(lint n) {
	map<lint, lint>ans;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

lint xor128() {
	static lint x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	lint t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}

double dis(D a, D b) {
	double x = a.first - b.first, y = a.second - b.second;
	return sqrt(x * x + y * y);
}

class unionfind {
private:
	int par[2 * 100010], ranks[2 * 100010], sizeth[2 * 100010];
public:
	void init(int n) {
		for (int i = 0; i < n; ++i) {
			par[i] = i;
			ranks[i] = 0;
			sizeth[i] = 1;
		}
	}

	int root(int x) {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return;
		if (ranks[x] < ranks[y]) {
			par[x] = y;
			sizeth[y] += sizeth[x];
		}
		else {
			par[y] = x;
			if (ranks[x] == ranks[y]) ++ranks[x];
			sizeth[x] += sizeth[y];
		}
	}
};

int n;
double a1, a2, b1, b2, c1, c2;
double da, db, dc; //距離
double a, b, c; //cos
double o, ox, oy, r;
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2;
		dc = dis(D(a1, a2), D(b1, b2));
		da = dis(D(b1, b2), D(c1, c2));
		db = dis(D(c1, c2), D(a1, a2));
		a = (db * db + dc * dc - da * da) / (2 * db * dc);
		b = (dc * dc + da * da - db * db) / (2 * dc * da);
		c = (da * da + db * db - dc * dc) / (2 * da * db);
		o = a * da + b * db + c * dc;
		ox = (a1 * a * da + b1 * b * db + c1 * c * dc) / o;
		oy = (a2 * a * da + b2 * b * db + c2 * c * dc) / o;
		r = dis(D(ox, oy), D(a1, a2));
		printf("%.3lf %.3lf %.3lf\n", ox, oy, r);
	}
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
    double a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    double x,y;
    y=((e-a)*(a*a+b*b-c*c-d*d)-(c-a)*(a*a+b*b-e*e-f*f))/(2*(e-a)*(b-d)-2*(c-a)*(b-f));
    if(c-a!=0){
         x=(2*(b-d)*y-a*a-b*b+c*c+d*d)/(2*(c-a));
    }else{
        x=(2*(b-f)*y-a*a-b*b+e*e+f*f)/(2*(e-a));
    }
    double r=sqrt((x-a)*(x-a)+(y-b)*(y-b));
    printf("%.3f %.3f %.3f\n",x,y,r);
    }
    
    
    return 0;
}