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<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;
class Point {
public:
	double x, y;
};
double distance(Point x, Point y) {
	return pow(pow(fabs(x.x - y.x), 2) + pow(fabs(x.y - y.y), 2), 0.5);
}
int main() {
	cout << setprecision(4);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		Point p[3], s;
		for (int i = 0; i < 3; i++) {
			cin >> p[i].x >> p[i].y;
		}
		double a, b, c, d, e, f;
		a = (-2)*p[0].x + 2 * p[1].x;
		b = (-2)*p[0].y + 2 * p[1].y;
		c = (-2)*p[0].x + 2 * p[2].x;
		d = (-2)*p[0].y + 2 * p[2].y;
		e = pow(p[0].x, 2) + pow(p[0].y, 2) - pow(p[1].x, 2) - pow(p[1].y, 2);
		f = pow(p[0].x, 2) + pow(p[0].y, 2) - pow(p[2].x, 2) - pow(p[2].y, 2);
		s.x = (b*f - d*e) / (a*d - b*c);
		s.y = (a*f - c*e) / (b*c - a*d);
		double k = distance(p[0], s);
		s.x = round(s.x * 1000) / 1000;
		s.y = round(s.y * 1000) / 1000;
		k = round(k * 1000) / 1000;
		cout << s.x << " " << s.y << " " << k << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <complex>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
typedef complex<double> P;
typedef long long ll;

int n;
double x[3],y[3];
double px,py,r;

double in_pro(P a,P b){
	return a.real()*b.real()-a.imag()*b.imag();
}

double squ(P a, P b){
	double s = (a.real()*b.imag()-a.imag()*b.real())/2;
	if(s<0) s*=-1;
	return s;
}


int main(){
	cin>>n;
	rep(i,n){
		rep(i,3){
			cin>>x[i]>>y[i];
		}
		P a(x[1]-x[0],y[1]-y[0]), b(x[2]-x[0],y[2]-y[0]);
		double alen = abs(a),blen = abs(b);
		alen*=alen; blen*=blen;
		double inp = in_pro(a,b);
		double s = squ(a,b);
		//P I=(inp-alen*alen)/(inp*inp-alen*alen)*a + (inp-blen*blen)/(inp*inp-blen*blen)*b;
		P I=(blen*(alen-inp)*a + alen*(blen-inp)*b)/((alen*blen-inp*inp)*2);
		//cout<<alen<<" "<<blen<<" "<<inp<<endl;
		
		printf("%0.3f %0.3f %0.3f\n",I.real()+x[0],I.imag()+y[0],abs(I));
		}
	return 0;
	
}

C++: #include <iostream>
#include <cstdio>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double x1,y1,x2,y2,x3,y3,xp,yp,r;
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		double a=x2-x1,b=y2-y1,c=x3-x1,d=y3-y1;
		if(a==0){
			xp = c/2+d/2/c-b*d/2/c;
			yp = b/2;
		}else if(b==0){
			xp = a/2;
			yp = -a*c/2/d+c*c/2/d+d/2;
		}else if(c==0){
			xp = a/2+b/2/a-d*b/2/a;
			yp = d/2;
		}else if(d==0){
			xp = c/2;
			yp = -a*c/2/b+a*a/2/b+b/2;
		}else{
			xp = (d*(a*a+b*b)-b*(c*c+d*d))/(a*d-b*c)/2;
			yp = -a*xp/b+a*a/2/b+b/2;
		}
		r = sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
		printf("%.3lf %.3lf %.3lf\n",xp,yp,r);
	}
	return 0;
}

C++: #include<complex.h>
#include<stdio.h>
#define F(a,b,c) acos((b*b+c*c-a*a)/2/b/c)
#define G(a,b) pow(a-b,2)
#define H(a,b,c,d) sqrt(G(a,b)-G(c,d))
int main(){
	typedef double D;
	int n;D d,e,f,g,h,i;
	for(scanf("%d",&n);n--;){
		scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);
		//complex a(d,g),b(e,h),c(f,i);
		D /*A=abs(b-c),B=abs(c-a),C=abs(a-b),*/
		A=H(e,h,d,g),B=H(f,i,d,g),C=(d,g,e,h),
		L=F(A,B,C),s=sin(2*L),t=sin(2*F(B,C,A)),u=sin(2*F(C,A,B)),v=s+t+u;
		printf("%.3f %.3f %.3f\n",(d*s+e*t+f*u)/v,(g*s+h*t+i*u)/v,A/sin(L)/2);
	}
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main() {
	double x1, x2, x3, px, y1, y2, y3, py,r;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		if (y1 == y2) {
			px = (x1 + x2) / 2;
			py = (x1 - x3)*(x2 - x3) / (2 * (y3 - y1)) + (y1 + y3) / 2;
		}
		else if (y1 == y3) {
			px = (x1 + x3) / 2;
			py = (x1 - x2)*(x3 - x2) / (2 * (y2 - y1)) + (y1 + y2) / 2;
		}
		else {
			px = ((x1*x1 - x2*x2) / (y2 - y1) - (x1*x1 - x3*x3) / (y3 - y1) + y3 - y2) / (2 * ((x1 - x2) / (y2 - y1) - (x1 - x3) / (y3 - y1)));
			py = (px - (x1 + x2) / 2)*(x1 - x2) / (y2 - y1) + (y1 + y2) / 2;
		}
		r = sqrt((px - x1)*(px - x1) + (py - y1)*(py - y1));
		px = double(int(1000 * px + 0.5)) / 1000;
		py = double(int(1000 * py + 0.5)) / 1000;
		r = double(int(1000 * r + 0.5)) / 1000;
		printf("%.3f %.3f %.3f\n", px, py, r);
	}
	return 0;
}

C++: /* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */
/* include {{{ */
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
using namespace std;
/* }}} */

// #define int long long

/* cpp template {{{ */
/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const double EPS = 1e-12;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}

/* }}} */

#define sq(x) ((x) * (x))

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

  int n;
  cin >> n;

  while (n--){
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    double a = 2 * (x1 - x2), b = 2 * (y1 - y2),
           c = 2 * (x1 - x3), d = 2 * (y1 - y3);

    double y = (c * (sq(x1) * sq(y1) - sq(x2) - sq(y2)) - a * (sq(x1) + sq(y1) - sq(x3) - sq(y3))) / (c * b == a * d ? EPS : c * b - a * d);
    double x = (sq(x1) + sq(y1) - sq(x3) - sq(y3) - d * y) / (c == 0 ? EPS : c);
    double r = sqrt(sq(x - x1) + sq(y - y1));
    printf("%.3f %.3f %.3f\n", x + 0.0, y + 0.0, r);
  }

  return (0);
}