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 <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>


#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


int main()
{
	int n;
	cin >> n;
	REP(i, n){
		double x1, x2, x3, y1, y2, y3;
		cin >> x1>> x2 >> x3 >> y1 >> y2 >> y3;

		double x21 = x2 - x1;
		double x31 = x3 - x1;
		double y21 = y2 - y1;
		double y31 = y3 - y1;
		/*
		double xc = 1.0*((y31*(x21*x21 + y21*y21)) - (y21*(x31*x31 + y31*y31))) /
			(2 * (x21*y31 - y21*x31));

		double yc = 1.0*((x21*(x31*x31 + y31*y31)) - (x31*(x21*x21 + y21*y21))) /
			(2 * (x21*y31 - y21*x31));	
		*/

		double xc = ((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 yc = ((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 d = (xc - x1)*(xc - x1) + (yc - y1)*(yc - y1);
		d = sqrt(d);

		printf("%.3lf %.3lf %.3lf\n", xc, yc, d);
	}

}

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

using namespace std;
typedef complex<double> P;

double cross(P a,P b){return (conj(a)*b).imag();}

int main(){
  int n;
  scanf("%d",&n);
  while(n--){
    P a,b,c;
    cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag();
    P m = (a+b)/P(2,0);
    P n = (a+c)/P(2,0);
    P s = (a-b)*P(0,1);
    P t = (a-c)*P(0,1);
    double e = cross(n-m,t)/cross(s,t);
    P o = m+s*P(e,0);
    double r = abs(a-o);
    printf("%.3f %.3f %.3f\n",o.real(),o.imag(),r);
  }
}

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

typedef struct
{
  double x, y;
} Point;

int main()
{
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    Point A, B, C;
    scanf("%lf %lf %lf %lf %lf %lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y);

    double a = sqrt((B.x-C.x)*(B.x-C.x) + (B.y-C.y)*(B.y-C.y));
    double b = sqrt((C.x-A.x)*(C.x-A.x) + (C.y-A.y)*(C.y-A.y));
    double c = sqrt((A.x-B.x)*(A.x-B.x) + (A.y-B.y)*(A.y-B.y));

    double angleA = acos((b*b+c*c-a*a) / (2*b*c));
    double angleB = acos((c*c+a*a-b*b) / (2*c*a));
    double angleC = acos((a*a+b*b-c*c) / (2*a*b));

    double sin2A = sin(2 * angleA);
    double sin2B = sin(2 * angleB);
    double sin2C = sin(2 * angleC);

    double x = (A.x*sin2A + B.x*sin2B + C.x*sin2C) / (sin2A+sin2B+sin2C);
    double y = (A.y*sin2A + B.y*sin2B + C.y*sin2C) / (sin2A+sin2B+sin2C);
    double r = (a / (2 * sin(angleA)));

    printf("%.3f %.3f %.3f\n", round(x*1000.0)/1000.0, round(y*1000.0)/1000.0, round(r*1000.0)/1000.0);
  }
  return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

double EPS = 1e-10;
double add(double a, double b){
  if(abs(a+b) < EPS* (abs(a) + abs(b))) return 0;
  return a+b;
}

struct P{
  double x,y;
  P(){}
  P(double _x,double _y):x(_x),y(_y){}
  P operator + (P p){
    return P(add(x,p.x) ,add(y,p.y));
  }
  P operator - (P p){
    return P(add(x,-p.x) ,add(y,-p.y));
  }
  P operator * (double d){
    return P(x * d,y * d);
  }
  friend ostream& operator<<(ostream& os,const P& p){
    os << "("<<p.x <<","<<p.y<<")";
    return os;
  }
  double dot(P p){
    return add(x * p.x,y*p.y);
  }
  double det(P p){
    return add(x*p.y,-y*p.x);
  }
  double dist2(P p){
    return ((*this-p).x * (*this-p).x) + ((*this-p).y * (*this-p).y);
  }
  P GetCenter(P &p){
    return P((*this+p).x/2,(*this+p).y/2);
  }
  double GetSlope(P &p){
    P tmp = *this - p;
    return tmp.y/tmp.x;
  }
};
//???????????????????????¨?????????
bool on_seg(P p1,P p2,P q){
  return (p1-q).det(p2-q) == 0 && (p1-q).dot(p2-q) <= 0;
}
//???????°????
P intersection(P p1, P p2, P q1,P q2){
  return p1 + (p2-p1) * ((q2 - q1).det(q1-p1) / (q2 - q1).det(p2-p1)) ;
}
int is_prime[100001];
void Eratosthenes(int N){
  for(int i = 0; i < N; i++){
    is_prime[i] = 1;
  }
  is_prime[1] = 0;
  for(int i = 2; i*i < N ; i++){
    if(is_prime[i]){
      for(int j = 0; i * (j + 2) < N; j++){
        is_prime[i *(j + 2)] = 0;
      }
    }
  }
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  P p1,p2,p3;
  cin >> n;
  rep(i,n){
    cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;
    P p12,p23,ans;
    double slp12,slp23,t1,t2;
    p12 = p1.GetCenter(p2);
    p23 = p2.GetCenter(p3);
    slp12 = p1.GetSlope(p2),slp23 = p2.GetSlope(p3);
    if(p1.y == p2.y && p2.x == p3.x){
      ans.x = p12.x;
      ans.y = p23.y;
    }
    else if(p2.y == p3.y && p1.x == p2.x){
      ans.x = p23.x;
      ans.y = p12.y;
    }
    else{
      if(p1.y == p2.y){
        ans.x = p12.x;
        ans.y = (-1/slp23) * ans.x + t2;
      }
      else if(p2.y == p3.y){
        ans.x = p23.x;
        ans.y = (-1/slp12) * ans.x + t1;
      }
      else{
        t1 = (slp12 != inf)?p12.y + p12.x / slp12: 0;
        t2 = (slp23 != inf)?p23.y + p23.x / slp23: 0;
        ans.x = (t1-t2)/(1/slp12 - 1/slp23);
        if(slp12 != inf){
          ans.y = (-1/slp12) * ans.x + t1;
        }
        else{
          ans.y = (-1/slp23) * ans.x + t2;
        }
      }
    }
    fcout(3) << ans.x << " " << ans.y << " " << sqrt(ans.dist2(p1))<<endl;
  }
  return 0;
}