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 <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

int main(void){
	int n , i , buf;
	float x1,x2,x3,y1,y2,y3,a1,a2,b1,b2,c1,c2,xp,yp,r;
	scanf("%d" , &n);
	for(i=1;i<=n;i++){
		scanf("%f %f %f %f %f %f" , &x1 , &y1 , &x2 , &y2 , &x3 , &y3);
		a1 = 2 * (x2 - x1);
		b1 = 2 * (y2 - y1);
		c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
		a2 = 2 * (x3 - x1);
		b2 = 2 * (y3 - y1);
		c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		xp = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
		yp = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
		r = sqrt((xp - x1) * (xp - x1) + (yp - y1) * (yp - y1));
		printf("%.3f %.3f %.3f\n" , xp , yp , r);
	}
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        double x1,x2,x3,y1,y2,y3;
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        double a1,a2,b1,b2,c1,c2;
        a1=2*(x2-x1);b1=2*(y2-y1);
        a2=2*(x3-x1);b2=2*(y3-y1);
        c1=x1*x1-x2*x2+y1*y1-y2*y2;
        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 a=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
        double b=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
        double c=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
        double s=(a+b+c)/2;
        double r=(a*b*c)/(4*sqrt(s*(s-a)*(s-b)*(s-c)));
        printf("%.3f %.3f %.3f\n",x,y,r);
    }
}

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;
}

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;
}

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 = npx / dp, py = npy / dp;
    double r = sqrt(f(px - x1) + f(py - y1));
    cout << prec(3) << roundp(px, 3) << ' ' << roundp(py, 3) << ' ' << roundp(r, 3) << endl;
  }
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

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 a = -x1 + x2, b = -y1 + y2, c = (-pow(x1, 2) - pow(y1, 2) + pow(x2, 2) + pow(y2, 2)) / 2;
		double d = -x1 + x3, e = -y1 + y3, f = (-pow(x1, 2) - pow(y1, 2) + pow(x3, 2) + pow(y3, 2)) / 2;
		double y = (c*d - a*f) / (b*d - a*e);
		double x = (f - e*y) / d;
		cout <<fixed<<setprecision(20)<< x << " " << y <<" "<< hypot(x1 - x, y1 - y) << endl;
	}
}