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 <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef double D;
typedef complex<D> P;
typedef vector<P> VP;
P minEnclosingCircle(const VP& ps) {
  P c;
  double move = 0.5;
  r(i,41) {  // 2^(-39-1) \approx 0.9e-12
    r(t,200) {
      D max = 0;
      int k = 0;
      r (j, ps.size()) if (max < norm(ps[j]-c)) {
        max = norm(ps[j]-c);
        k = j;
      }
      c += (ps[k]-c) * move;
    }
    move /= 2;
  }
  return c;
}
int main(){
    int n;
    cin>>n;
    r(i,n){
        VP p;
        D a,b;
        r(j,3){
            cin>>a>>b;
            p.push_back(P(a,b));
        }
        P t=minEnclosingCircle(p);
        D dis=abs(p[0]-t);
        printf("%.3f %.3f %.3f\n",t.real(),t.imag(),dis);
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

using T = double;
const T EPS = 1e-10;

/* Point */
using P = complex<T>;
#define x real()
#define y imag()
template <typename T> inline bool eq(T p, T q) { return abs(p - q) < EPS; }
inline int sgn(T x) { return (T(0) < x) - (x < T(0)); }
inline T dot(P v, P w) { return (conj(v) * w).x; }
inline T cross(P v, P w) { return (conj(v) * w).y; }
inline bool isOrth(P v, P w) { return dot(v, w) == 0; }
inline bool isPara(P v, P w) { return cross(v, w) == 0; }
inline P translate(P p, P v) { return p + v; }
inline P scale(P p, P c, T k) { return c + (p - c) * k; }
inline P rot(P p, T a) { return p * polar(1.0, a); }
inline P rot90(P p) { return {-p.y, p.x}; }
inline T orient(P a, P b, P c) { return cross(b - a, c - a); }
istream& operator>>(istream& is, P& p) {
    T xx, yy;
    is >> xx >> yy;
    p = P(xx, yy);
    return is;
}

/* Circle */
struct C : P {
    T r;
    C(P p = P(0.0, 0.0), T r = 0.0) : P(p), r(r) {}
    friend ostream& operator << (ostream& os, const C& c) { return os << '(' << c.x << ", " << c.y << ", " << c.r << ')'; }
};

P circumCenter(P a, P b, P c) {
    b -= a, c -= a;
    assert(cross(b, c) != 0);
    return a + rot90(b * norm(c) - c * norm(b)) / cross(b, c) / T(2);
}

int main() {
    cout << fixed << setprecision(3);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        P p[3];
        for (int j = 0; j < 3; ++j) {
            cin >> p[j];
        }
        P o = circumCenter(p[0], p[1], p[2]);
        cout << o.x << " " << o.y << " " << abs(p[0] - o) << endl;
    }
}

C++: #include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#define SQ(x) ((x)*(x))
using namespace std;

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3;
  double a,b,c,d,e,f,l,C,r,xp,yp,m; // 3辺
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    b = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c = sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    C = (sqrt(fabs(1.0-C*C))); // sinθに変更
    r = (c/2*C); // 接弦定理
    
    a = (x1 - x2);
    b = (y1 - y2);
    c = -1 * (SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2));
    d = (x1 - x3);
    e = (y1 - y3);
    f = -1 * (SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3));
    
    l = (c * e - b * f) / (e * a - b * d);
    m = (d * c - a * f) / (d * b - e * a);
    
  
    printf("%.3f %.3f %.3f\n", l / -2.0, m / -2.0, r);
  }
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

double roundPrec(double x, int prec) {
  double t = pow(10, prec);
  return double((int) (x * t + 0.5)) / t;
}

double f(double x) {
  return x * x;
}

template<typename T>
constexpr T det2(const T &a1, const T &a2, const T &b1, const T &b2) {
  return a1 * b2 - b1 * a2;
}

void solve() {
  int n;
  cin >> n;
  rep(i, n) {
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double npx = det2(y2 - y1, y3 - y1, f(x1) - f(x2) + f(y1) - f(y2), f(x1) - f(x3) + f(y1) - f(y3));
    double npy = det2(y2 - y1, y3 - y1, f(x1) - f(x2) + f(y1) - f(y2), f(x1) - f(x3) + f(y1) - f(y3));
    double dp  = 2 * det2(x2 - x1, x3 - x1, y2 - y1, y3 - y1);
    double px = roundPrec(npx / dp, 3), py = roundPrec(npy / dp, 3);
    double r = roundPrec(sqrt(f(px - x1) + f(py - y1)), 3);
    cout << prec(3) << px << ' ' << py << ' ' << r << endl;
  }
}

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

int main(){

  double x1, x2, x3, y1, y2, y3, mx, my, lx, ly, dm, dl, cx, cy, r;
  
  cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
  
  mx = (x1 + x2) / 2;
  my = (y1 + y2) / 2;
  dm = (y1 - y2) / (x1 - y2);
  lx = (x2 + x3) / 2;
  ly = (y2 + y3) / 2;
  dl = (y2 - y3) / (x2 - x3);
  cx = (my + dm * mx) - (ly + dl * lx);
  cy = (ly + dl * lx) * dm - (my + dm * mx) * dl;
  
  r = sqrt((x1 - cx) * (x1 - cx) + (y1 - cy) * (y1 - cy));

  cx = round(cx * 1000) / 1000.0;
  cy = round(cy * 1000) / 1000.0;
  r = round(r * 1000) / 1000.0;

  printf("%.3f %.3f %.3f\n", cx, cy, r);

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main() {

	int n;
	double x1, x2, x3, y1, y2, y3;
	double X, Y, R;
	double a, b, c, d, e, f;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a = -x2 + x3;
		b = -x1*x1 + x2*x2 - y1*y1 + y2*y2;
		c = x1 - x2;
		d = -x2*x2 + x3*x3 - y2*y2 + y3*y3;
		e = -c * 2 * (y2 - y3);
		f = a * 2 * (y1 - y2);
		Y = (a*b + c*d) / (e - f);
		X = (b+2*Y*(y1-y2))/(-2*c);
		R = sqrt((X - x1)*(X - x1) + (Y-y1)*(Y-y1));

		if (X > 0)
			X = (int)(X * 1000 + 0.5) ;
		else X = (int)(X * 1000 - 0.5) ;

		if (Y>0)
			Y = (int)(Y * 1000 + 0.5) ;
		else Y = (int)(Y * 1000 - 0.5) ;

		if (R > 0)
			R = (int)(R * 1000 + 0.5);
		else R = (int)(R * 1000 - 0.5);

		printf("%.3f %.3f %.3f\n", X/1000, Y/1000, R/1000);
	}

	return 0;
}