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 <iomanip>
#include <vector>
#include <sstream>
#include <string>
#include <cmath>

using namespace std;

const int EPS=1e-9;

namespace FP {
    bool isZero(double x) {
        return (abs(x) <= EPS);
    }
};

struct Point {
    double x, y;
    Point(double x=0, double y=0) : x(x), y(y) {}
    string to_s() {
        ostringstream os;
        os << "(" << x << "," << y << ")";
        return os.str();
    }
    bool operator<(const Point &o) const {
        return x == o.x ? y < o.y : x < o.x;
    }
    Point operator+(const Point &o) const {
        return Point(x+o.x, y+o.y);
    }
    Point operator-(const Point &o) const {
        return Point(x-o.x, y-o.y);
    }
    Point operator*(const double m) const {
        return Point(x*m, y*m);
    }
    Point operator/(const double d) const {
        return Point(x/d, y/d);
    }
    // 外積
    double cross(const Point &o) const {
        return x * o.y - y * o.x;
    }
    // 内積
    double dot(const Point &o) const {
        return x * o.x + y * o.y;
    }
    // ベクトルがx軸となす角
    double atan() const {
        return atan2(y, x);
    }
    // ベクトルの長さの二乗
    double norm() const {
        return dot(*this);
    }
};

struct Line {
    double a, b, c;
    Line(double a=0, double b=0, double c=0) :
        a(a), b(b), c(c) {}
    Point intersectionPoint(const Line &l) const {
        double d = a * l.b - l.a * b;
        if (!intersects(l)) {
            throw string("The 2 Lines are parallel");
        }
        double x = (b * l.c - l.b * c) / d;
        double y = (l.a * c - a * l.c) / d;
        return Point(x, y);
    }
    bool intersects(const Line &l) const {
        if ((a == 0 && l.a == 0) || (b == 0 && l.b == 0))
            return false;
        else 
            return !FP::isZero(a * l.b - l.a * b);
    }
    string to_s() {
        ostringstream os;
        os << a << ' ' << b << ' ' << c;
        return os.str();
    }
    static Line fromPoints(const Point &a, const Point &b) {
        double dx = b.x - a.x;
        double dy = b.y - a.y;
        return Line(dy, -dx, dx * a.y - dy * a.x);
    }
    static Line fromPoints(double x1, double y1, double x2, double y2) {
        return fromPoints(Point(x1, y1), Point(x2, y2));
    }
};

struct LineSegment {
    Point start, end;
    LineSegment(const Point &start, const Point &end) : start(start), end(end) {}
    LineSegment(double x1, double y1, double x2, double y2) : start(Point(x1, y1)), end(Point(x2, y2)) {}
    string to_s() {
        ostringstream os;
        os << '(' << start.x << ',' << start.y << ')' << '-' << '(' << end.x << ',' << end.y << ')' << endl;
        return os.str();
    }
    Line toLine() const {
        return Line::fromPoints(start, end);
    }
    bool intersects(const Line &l) const {
        double t1 = l.a * start.x + l.b * start.y + l.c;
        double t2 = l.a * end.x + l.b * end.y + l.c;
        return t1 * t2 <= 0;
    }
    bool intersects(const LineSegment &s) const {
        return intersects(s.toLine()) && s.intersects(toLine());
    }
    Line perpendicularBisector() const {
        Point p1 = (start + end) / 2;
        Point p2;
        p2.x = -(end - p1).y;
        p2.y = (end - p1).x;
        p2 = p2 + p1;
        return Line::fromPoints(p1, p2);
    }
};

int main() {
    int n; cin >> n;
    Point p[3];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) cin >> p[j].x >> p[j].y;
        LineSegment a(p[0], p[1]);
        LineSegment b(p[0], p[2]);
        Line s = a.perpendicularBisector();
        Line t = b.perpendicularBisector();
        Point c;
        c = s.intersectionPoint(t);
        double r = sqrt((p[0] - c).norm());
        cout << fixed << setprecision(3);
        cout << c.x << ' ' << c.y << ' ' << r << endl;
    }

    return 0;
}

C++: #include<complex>
#include<stdio.h>
#include<cmath>
#define F(a,b,c) acos((b*b+c*c-a*a)/2/b/c)
int main(){
	typedef double D;
	int n;D d,e,f,g,h,i;
	for(scanf("%d",&n);n--;){
		scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);
		std::complex<D> a(d,g),b(e,h),c(f,i);
		D A=abs(b-c),B=abs(c-a),C=abs(a-b),
		s=sin(2*F(A,B,C)),t=sin(2*F(B,C,A)),u=sin(2*F(C,A,B)),v=s+t+u;
		printf("%.3f %.3f %.3f\n",(d*s+e*t+f*u)/v,(g*s+h*t+i*u)/v,A/sin(F(A,B,C))/2);
	}
}

C++: #include <stdio.h>
#include <math.h>

int main(void)
{
	float x1, x2, x3, y1, y2, y3;
	float xp, yp, r;
	float rs;
	int n;
	
	scanf("%d", &n);
	
	while (n){
		scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
		
		yp = ((y1 - y3) * (y1 * y1 - y2 * y2 + x1 * x1 - x2 * x2) - (y1 - y2) * (y1 * y1 - y3 * y3 + x1 * x1 - x3 * x3)) / (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3));
		xp = ((x1 - x3) * (x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2) - (x1 - x2) * (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3)) / (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3));
		r = sqrt((x1 - xp) * (x1 - xp) + (y1 - yp) * (y1 - yp));
		
		printf("%.3f %.3f %.3f\n", xp, yp, r);
		
		n--;
	}
	
	return (0);
}

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 roundp(double x, int p) {
  double t = pow(10, p);
  return double((int) (x * t + 0.5)) / t;
}

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 d1 = x1 * x1 + y1 * y1, d2 = x2 * x2 + y2 * y2, d3 = x3 * x3 + y3 * y3;
    double npx = det2(d1, d2, y1, y2) + det2(d2, d3, y2, y3) + det2(d3, d1, y3, y1);
    double npy = det2(d2, d1, x2, x1) + det2(d3, d2, x3, x2) + det2(d1, d3, x1, x3);
    double dp  = 2 * (det2(x1, x2, y1, y2) + det2(x2, x3, y2, y3) + det2(x3, x1, y3, y1));
    double px = npx / dp, py = npy / dp;
    double r = hypot(px - x1, py - y1);
    cout << prec(3) << roundp(px, 3) << ' ' << roundp(py, 3) << ' ' << roundp(r, 3) << endl;
  }
}