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 <cstdio>
#include <math.h>
using namespace std;

double l(double x1, double y1, double x2, double y2){
	return sqrt(pow((x1-x2),2) + pow((y1-y2),2));
}

void solve(double x1, double y1, double x2, double y2, double x3, double y3){
	double a,b,c,ans_x,ans_y,ans_r;
	a = l(x1, y1, x2, y2);
	b = l(x1, y1, x3, y3);
	c = l(x2, y2, x3, y3);
	double A,B,C;
	A=a*a;
	B=b*b;
	C=c*c;
	
	double s = (a+b+c)/2.0;
	double S = sqrt(s*(s-a)*(s-b)*(s-c));
	double largeSd = S*S;
	ans_x = A/4.0*(B+C-A)/4.0*x1/largeSd + B/4.0*(C+A-B)/4.0*x2/largeSd + C/4.0*(A+B-C)/4.0*x3/largeSd;
	ans_y = A/4.0*(B+C-A)/4.0*y1/largeSd + B/4.0*(C+A-B)/4.0*y2/largeSd + C/4.0*(A+B-C)/4.0*y3/largeSd;
	
	ans_r = l(x1, y1, ans_x, ans_y);
	printf("%4.3f %4.3f, %4.3f\n",ans_x, ans_y, ans_r);
}

int main(){
	int n;
	cin >> n;
	double x1[n],y1[n],x2[n],y2[n],x3[n],y3[n];
	for(int i = 0; i < n; i++){
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i] >> x3[i] >> y3[i];
	}
	for(int i = 0; i < n; i++){
		solve(x1[i], y1[i], x2[i], y2[i], x3[i], y3[i]);
	}
}

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

int main(){
	int n; cin >> n;
	double x[3] = {};
	double y[3] = {};

	for(int i=0; i<3; i++)
		cin >> x[i] >> y[i];

	double a,b,c,d,e,f;
	a = x[1] - x[0];
	b = y[1] - y[0];
	c = x[2] - x[0];
	d = y[2] - y[0];
	e = (-pow(x[0],2.0)+pow(x[1],2.0)-pow(y[0],2.0)+pow(y[1],2.0))/2;
	f = (-pow(x[0],2.0)+pow(x[2],2.0)-pow(y[0],2.0)+pow(y[2],2.0))/2;

	double Xo = (d*e-b*f)/(a*d-b*c);
	double Yo;
	if(b != 0)
		Yo=(e-a*Xo)/b;
	else
		Yo=(f-c*Xo)/d;

	cout << fixed;
	cout << setprecision(3) << Xo << " " << Yo << " " << sqrt(pow(Xo-x[0],2.0)+pow(Yo-y[0],2.0)) << endl;

return 0;
}

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

void gradcut(double *a,double *b,double x1,double y1,double x2,double y2);

int main() {
    double x[3],y[3],a[2],b[2],rx,ry,r;
    int n;
    std::cin >> n;
    for(int j=0;j<n;j++){
        int am=0,add=1;;
        for(int i=0;i<3;i++) std::cin >> x[i] >> y[i];
        for(int i=0;i<3;i++){
            if(i==2) add=-2;
            if(x[i]!=x[i+add]&&y[i]!=y[i+add]){
                gradcut(&a[am],&b[am],x[i],x[i+add],y[i],y[i+add]);
                am++;
                if(am>2) break;
            }else if(x[i]==x[i+add]){
                a[am]=0;
                b[am]=(y[i]+y[i+add])/2;
                am++;
                if(am>2) break;
            }
        }


        rx = (b[1]-b[0])/(a[0]-a[1]);
        ry = a[0]*rx+b[0];
        r=sqrt((x[0]-rx)*(x[0]-rx)+(y[0]-ry)*(y[0]-ry));
        printf("%.3f %.3f %.3f",rx,ry,r);
    }
    return 0;
}

void gradcut(double *a,double *b,double x1,double x2,double y1,double y2){
    *a=-(x2-x1)/(y2-y1);
    *b=(y1+y2)/2-*a*(x1+x2)/2;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <iomanip>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define SQ(i) ((i) * (i))
using namespace std;

int main(){
  double x1, y1, x2, y2, x3, y3;
  double a1, b1, c1, a2, b2, c2, x, y, a, b, c, cos_a, sin_a, r;
  int n;
  scanf("%d", &n);
  while(n--){
    scanf("%lf%lf%lf%lf%lf%lf", &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 = SQ(x3-x) + SQ(y3 - y);
    r = sqrt(r);
    printf("%.3f %.3f %.3f\n",x, y, r);
  }
  return 0;
}

C++: /* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* include {{{ */
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <iostream>
#include <algorithm>

using namespace std;

/*  }}} */
/* cpp template {{{*/


#define endl '\n'
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;      // ??§?¨?????????????double???long double?????????
typedef long long ll;
typedef long double lb;
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y, int x, int H, int W){return (y >= 0 && x >= 0 && y < H && x < W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}

/* ?????° */
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


/* }}} */

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // ???????????????
  return a1 + d1/d2 * (a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main()
{
  //cin.tie(0);
  //ios::sync_with_stdio(false);

  int x = in();
  
  for (int i = 0; i < x; i++){
    D a1, a2, b1, b2, c1, c2;
    cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2;
    P p = circumcenter( P(a1, a2), P(b1, b2), P(c1, c2));
    D r = sqrt(pow(a1 - p.X, 2) + pow(a2 - p.Y, 2));
    printf("%.3f %.3f %.3f", p.X, p.Y, r);

    cout << endl;
  }
  return (0);
}