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 <cmath>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
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 x,y,r1,r2,r3;
    double a,b,c,d,e,f;
    a=2*x1-2*x2;
    b=2*y1-2*y2;
    c=x1*x1-x2*x2+y1*y1-y2*y2;
    d=2*x2-2*x3;
    e=2*y2-2*y3;
    f=x2*x2-x3*x3+y2*y2-y3*y3;
    y=(a*f-c*d)/(a*e-b*d);
    x=(c-b*y)/a;
    r1=sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));
        r2=sqrt((x2-x)*(x2-x)+(y2-y)*(y2-y));
        r3=sqrt((x3-x)*(x3-x)+(y3-y)*(y3-y));
    
    printf("%.3f %.3f %.3f\n",x,y,r1);
}
}

C++: //
//  main.cpp
//  adsfdsgsg
//
//  Created by h3037175 on 2017/07/31.
//  Copyright ?? 2017??´ h3037175. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <math.h>
#include<algorithm>
#include <utility>
#define nan -100000
using namespace std;
bool isY(double y1,double y2,double y3){
    if(y1==y2 || y1==y3 || y2==y3 ){
        return true;
    }
    else {
        return false;
    }
}
bool isX(double x1,double x2,double x3){
    if(x1==x2 || x1==x3 || x2==x3 ){
        return true;
    }
    else {
        return false;
    }
}
int main() {
    int n;
    double x1,x2,x3,y1,y2,y3,px,py,r;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        double X[3]={x1,x2,x3},Y[3]={y1,y2,y3};
        sort(X,X+3);sort(Y,Y+3);
        px=2/(X[2]-X[0]);
        py=2/(Y[2]-Y[0]);
        if(isY(y1,y2,y3) || isX(x1,x2,x3)){
            int a;
            a=px*px+py*py;
            r=sqrt(a);
        }
        else{
            while(1){
                
            }
        }
        printf("%.3f %.3f %.3f",px,py,r);
        cout<<endl;
    }
    return 0;
}
//3633
/*
 
 
 
 
                                  /
                                 /|
                                / |
                               /  |
                              /   |
                             /    |
                            / |   |
                           /  |   |
                          /   |   |
                         /    |   |
                        /     |   |
                       /      |   |
                      /       |   |
                     /-------------








*/

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}

inline void fast_io(){ios_base::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple

double sq(double x){ return x * x; }
double sqs(double x, double y){ return sq(x) + sq(y); }

// ax + by = c
// dx + ey = f
void F(double *x, double *y, double a, double b, double c, double d, double e, double f)
{
  *y = (c * d - f * a) / (d * b - e * a);
  *x = (b * f - e * c) / (d * b - e * a);
}

int main()
{
  int n = in();
  while (n--){
    double x0, y0, x1, y1, x2, y2;
    cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2;
    // (x - a)^2 + (y - b)^2 = r^2
    // x^2 + y^2 + lx + my + n = 0
    // -a = l / 2
    // -b = m / 2
    double l, m;
    F(&l, &m, x0 - x1, y0 - y1, sqs(x1, y1) - sqs(x0, y0), x0 - x2, y0 - y2, sqs(x2, y2) - sqs(x0, y0));
    double px = -l / 2, py = -m / 2;
    double r = sqrt(sq(x0 - px) + sq(y0 - py));
    printf("%.3lf %.3lf %.3lf\n", px, py, r);
  }
  return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <complex>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef complex<double> P;
int n;

double cross(P p1,P p2) {
    return (real(p1)*imag(p2) - imag(p1)*real(p2));
}
double calc_S(P p1,P p2,P p3) {
    double ret = 0.0;
    p1 -= p3;
    p2 -= p3;

    ret = cross(p1,p2)/2.0;
    
    return abs(ret);
}

int main() {
    cin>>n;
    while(n-->0) {
        double x1_,y1_;
        double x2_,y2_;
        double x3_,y3_;
        cin>>x1_>>y1_>>x2_>>y2_>>x3_>>y3_;
        P p1(x1_,y1_);
        P p2(x2_,y2_);
        P p3(x3_,y3_);
        P A = p1-p2;
        P B = p2-p3;
        P C = p1-p3;
        double S = calc_S(p1,p2,p3);
        double R = abs(A)*abs(B)*abs(C)/S;
        R /= 4.0;
        
        P A1 = 2.0*(p2-p1);
        P B1 = 2.0*(p3-p1);
        P C1 = P(norm(p1)-norm(p2),norm(p1)-norm(p3));
        double X = cross(P(imag(A1),imag(B1)),C1)/cross(A1,B1);
        double Y = cross(C1,P(real(A1),real(B1)))/cross(A1,B1);
        printf("%.3lf %.3lf %.3lf\n",X,Y,R);

    }
    return 0;
}

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

int main()
{
    using namespace std;
    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 const p
            = ( ( 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 ) );

        double const q
            = ( ( 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 ) );

        double const r1 = sqrt( pow( p - x1, 2 ) + pow( q - y1, 2 ) );
        double const r2 = sqrt( pow( p - x2, 2 ) + pow( q - y2, 2 ) );
        double const r3 = sqrt( pow( p - x3, 2 ) + pow( q - y3, 2 ) );
        double const r = ( r1 + r2 + r3 ) / 3.0;

        cout << showpoint << fixed << setprecision( 3 );
        cout << p << " " << q << " " << r << endl;
    }
}