Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

C++: /*
NOTE :
*min_element(.begin(),.end())
*max_element(.begin(),.end())
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define MAX 100
#define INF 1<<20
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;
/////
template <class T>
void printMartix(valarray<valarray<T> > &A)
{
  int n = A.size();
  int m = A[0].size();
  REP(i,n){{REP(j,n) cout << A[i][j] << " ";} cout << endl;}
  cout << endl;
}

template <class T>
void printArray(valarray<T> &A)
{
  int n = A.size();
  REP(i,n) cout << A[i] << " ";
  cout << endl << endl;
}

template <class T>
bool solution(valarray<valarray<T> > &A, valarray<T> &b)
{
  int n = A.size();
  REP(i,n)
  {
    T a;
    //printMartix(A);
    //printArray(b);
    REP2(u,i,n)
    {
      a = A[u][i];
      if(a == 0) continue;
      else
      {
        if(u != i)
        {
          swap(A[i],A[u]);
          swap(b[i],b[u]);
        }
        break;
      }
      if(u == n-1) return false;
    }
    A[i] /= (1.0 * a);
    b[i] /= (1.0 * a);
    REP(j,n)
    {
      if(j == i) continue;
      b[j] -= b[i] * A[j][i];
      A[j] -= A[i] * A[j][i];
    }
    //printMartix(A);
    //printArray(b);
  }
  return true;
}

/////
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int n; cin >> n;
  REP(u,n)
  {
    double x[3], y[3]; REP(i,3) cin >> x[i] >> y[i];
    valarray<valarray<double> > A(valarray<double>(0.0,3),3);
    valarray<double> b(0.0,3);
    REP(i,3)
    {
      A[i][0] = x[i];
      A[i][1] = y[i];
      A[i][2] = 1;
      b[i] = -(x[i]*x[i] + y[i]*y[i]);
    }
    solution(A,b);
    double cx = -b[0] * 0.5;
    double cy = -b[1] * 0.5;
    double r = sqrt((x[0]-cx)*(x[0]-cx)+(y[0]-cy)*(y[0]-cy));
    printf("%.3lf %.3lf %.3lf\n",cx,cy,r);
  }
  return 0;
}

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);
        if(a==0)break;
        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++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

double marume( double x ){
	long long t = x * 1000 + 0.5;
	return t/1000.0;
}

int main(){
	int n;
	double tx, ty, x1, y1, x2, y2;
	
	cin >> n;
	while(n--){
		cin >> tx >> ty >> x1 >> y1 >> x2 >> y2;
		x1 -= tx; y1 -= ty;
		x2 -= tx; y2 -= ty;
		
		double dist1 = x1 * x1 + y1 * y1;
		double dist2 = x2 * x2 + y2 * y2;
		x1 *= 2; y1 *= 2;
		y1 *= 2; y2 *= 2;
		
		double detA = x1 * y2 - x2 * y1;
		double detX = dist1 * y2 - y1 * dist2;
		double detY = x1 * dist2 - dist1 * x1;
		double x = detX / detA;
		double y = detY / detA;
		double r = hypot(x, y);
		
		//x = marume(x);
		//y = marume(y);
		//r = marume(r);
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
#define int long long

signed main(){

        int n;
        scanf("%lld",&n);
        for(int i=0;i<n;i++){
                double x1,x2,x3,y1,y2,y3;
                scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
                double a = x2-x1;
                double b = y2-y1;
                double c = x3-x1;
                double d = y3-y1;
                double xc = 1/(a*d-b*c)*((a*a+b*b)/2*d+(c*c+d*d)/-2*b)+x1;
                double yc = 1/(a*d-b*c)*((a*a+b*b)/-2*c+(c*c+d*d)/2*a)+y1;
                printf("%.3f %.3f %.3f\n", xc, yc, sqrt((x1-xc)*(x1-xc)+(y1-yc)*(y1-yc)));

        }

        return 0;
}

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

int main() {
  int n;
  cin >> n;
  while (n--) {
    double x1, y1, x2, y2, x3, y3, px, py, r;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    px = ((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));
    py = ((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 - px) * (x1 - px) + (y1 - py) * (y1 - py));
    cout << fixed << setprecision(3) << px << " " << py << " " << r << endl;
  }
}

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

using namespace std;

int main(){
	int n;
	double p,q,r;
	double x1,x2,x3,y1,y2,y3;
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
		p = ((((x2*x2)+(y2*y2)-(x1*x1)-(y1*y1))/(2*(x2-x1)))-2*(y2-y1)*(((x3*x3)+(y3*y3)-(x1*x1)-(y1*y1))/(2*(y3-y1)))*(1/(2*(x2-x1))))*(1/(1-(((y2-y1)*(x3-x1))/((y3-y1)*(x2-x1)))));
		q = ((((x3*x3)+(y3*y3)-(x1*x1)-(y1*y1))/(2*(y3-y1)))-2*(x3-x1)*(((x2*x2)+(y2*y2)-(x1*x1)-(y1*y1))/(2*(x2-x1)))*(1/(2*(y3-y1))))*(1/(1-(((x3-x1)*(y2-y1))/((x2-x1)*(y3-y1)))));
		r = sqrt(((x1-p)*(x1-p))+((y1-q)*(y1-q)));
		printf("%.3f %.3f %.3f\n",p,q,r);
	}
}