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<math.h>

using namespace std;

int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,px,py,r;
	cin>>n;
	while(n--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		px=-1.0/2*((x2*x2-x1*x1)*(y3-y1)-(x3*x3-x1*x1)*(y2-y1)+(y3-y1)*(y2-y1)*(y2-y3))/((x3-x1)*(y2-y1)-(x2-x1)*(y3-y1));
		if(y2-y1 != 0){
			py=-(x2-x1)/(y2-y1)*(px-(x1+x2)/2)+(y1+y2)/2;
		}else{
			py=-(x3-x1)/(y3-y1)*(px-(x1+x3)/2)+(y1+y3)/2;
		}
		r=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
		cout<<px<<' '<<py<<' '<<r<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

struct Point{
    double x,y;
    Point(){}
    Point(double a,double b) : x(a),y(b){}
    Point operator + (Point p){
        return Point(x+p.x,y+p.y);
    }
    Point operator - (Point p){
        return Point(x-p.x,y-p.y);
    }
    Point operator * (double k){
        return Point(x*k,y*k);
    }
};

pair<double,double> Circumcenters(Point p1,Point p2,Point p3){
    double t = ( ((p3.x-p2.x)*(p2.x-p1.x)-(p3.y-p2.y)*(p1.y-p2.y)) / ((p2.x-p1.x)*(p3.y-p1.y)-(p1.x-p3.x)*(p1.y-p2.y)) ) / 2.0;

    double x = (p1.x+p3.x)/2.0 + t * (p1.y-p3.y);
    double y = (p1.y+p3.y)/2.0 + t * (p3.x-p1.x);
    return make_pair(x,y);
}

int main(){
    int n;cin>>n;
    rep(i,n){
        double x1,y1,x2,y2,x3,y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        double x,y;
        tie(x,y) = Circumcenters(Point(x1,y1),Point(x2,y2),Point(x3,y3));
        double d = sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
        printf("%.3f %.3f %.3f\n",x,y,d);
    }
}

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

int main(){
  int n;
  cin>>n;
  double x1,y1,x2,y2,x3,y3,x,y,r;
  double a,b,c,d,e,f;
  
  rep(i,n){
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    a=2*(x1-x2);
    b=2*(y1-y2);
    c=x1*x1-x2*x2+y1*y1-y2*y2;
    d=2*(x1-x3);
    e=2*(y1-y3);
    f=x1*x1-x3*x3+y1*y1-y3*y3;
    x=(c*e-b*f)/(a*e-b*d);
    y=(c*d-a*f)/(b*d-a*e);
    r=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
    
    printf("%.3f %.3f %.3f\n",x,y,r);
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <math.h>
using namespace std;
int main( void )
{
	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;

		for ( int j = 0; j < 3; j++ )
		{
			swap( x1, x2 );
			swap( y1, y2 );
			swap( x2, x3 );
			swap( y2, y3 );

			double a = 2.0 * x1 - 2.0 * x2;
			double b = 2.0 * y1 - 2.0 * y2;
			double c = 2.0 * x2 - 2.0 * x3;
			double d = 2.0 * y2 - 2.0 * y3;

			if ( a * b - c * d == 0.0 )
				continue;

			double e = x1 * x1 - x2 * x2 + y1 * y1 + y2 * y2;
			double f = x2 * x2 - x3 * x3 + y2 * y2 + y3 * y3;

			double x0 = ( d * e - b * f ) / ( a * b - c * d );
			double y0 = ( a * f - c * e ) / ( a * b - c * d );

			double r1 = sqrt( (x1-x0)*(x1-x0) + (y1-y0)*(y1-y0) );
			double r2 = sqrt( (x2-x0)*(x2-x0) + (y2-y0)*(y2-y0) );
			double r3 = sqrt( (x3-x0)*(x3-x0) + (y3-y0)*(y3-y0) );

			cout.setf( ios::fixed, ios::floatfield );
			cout << setprecision(3);
			if ( r1 == r2 && r1 == r3 )
				cout << x0 << " " << y0 << " " << r1 << endl;
		}

	}
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    double x1, y1, x2, y2, x3, y3;
    double a1, a2, b1, b2, c1, c2;
    double x, y, r;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> 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;

        x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));

        cout << setprecision(3) << fixed;
        cout << x << " " << y << " " << r << endl;
    }

    return 0;
}

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

double EPS = 1e-10;
const double PI = acos(-1);

using namespace std;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
  
  bool operator == ( const point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

struct circle{
  point p;
  double r;
};

circle circumscribed_circle(point p, point q, point r){
  double a[2],b[2],c[2];
  circle res;
    
    a[0]=2*(q.x-p.x);
    b[0]=2*(q.y-p.y);
    c[0]=p.x*p.x-q.x*q.x+p.y*p.y-q.y*q.y;
    
    a[1]=2*(r.x-p.x);
    b[1]=2*(r.y-p.y);
    c[1]=p.x*p.x-r.x*r.x+p.y*p.y-r.y*r.y;
    
    res.p.x=(b[0]*c[1]-b[1]*c[0])/(a[0]*b[1]-a[1]*b[0]);
    res.p.y=(c[0]*a[1]-c[1]*a[0])/(a[0]*b[1]-a[1]*b[0]);
 
    res.r=sqrt(pow(fabs(p.x-res.p.x),2)+pow(fabs(p.y-res.p.y),2));
    
    return res;
}

int main(void) {
  
  int n;
  point in[3];
  circle ans;
 
  cin >> n;
  
  while(n--){
    for(int i=0;i<3;i++)
      cin >> in[i].x >> in[i].y;

    ans=circumscribed_circle(in[0], in[1], in[2]);

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