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++: /* {{{ 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, y, r);
  }

  return (0);
}

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

int main(void)
{
    int n;
    double x1, x2, x3, y1, y2, y3;
    cin >> n;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
        double a = 2 * (x1 - x2);
        double b = 2 * (y1 - y2);
        double c = x1*x1 - x2*x2 + y1*y1 - y2*y2;
        double d = 2 * (x1 - x3);
        double e = 2 * (y1 - y3);
        double f = x1*x1 - x3*x3 + y1*y1 - y3*y3;
        double p1 = (e * c - b * f) / (e * a - b * d);
        double p2 = (d * c - a * f) / (d * b - a * e);
        double r = sqrt(pow(x1 - p1, 2) + pow(y1 - p2, 2));

        cout << p1 << " " << p2 << " " << r;
    }


    return 0;
}

C++: /* ??????w */

#include <cstdio>
#include <cmath>
#include <utility>
using namespace std;

#define double long double

struct Line {
  double a;
  double b;
  double c;
};

typedef pair<double, double> Pair;

int n;
double xs[3];
double ys[3];

double Dist(Pair p1, Pair p2) {
  double dx = p1.first - p2.first;
  double dy = p1.second - p2.second;
  return sqrtl(dx*dx+dy*dy);
}

Pair Intersect(Line &l1, Line &l2) {
  double a1 = l1.a;
  double b1 = l1.b;
  double c1 = l1.c;
  double a2 = l2.a;
  double b2 = l2.b;
  double c2 = l2.c;
  double x = (b1*c2 - b2*c1)/(a1*b2-a2*b1);
  double y = (a1*c2 - a2*c1)/(a2*b1-a1*b2);
  return Pair(x, y);
}

int main() {
  scanf("%d", &n);
  while (n--) {
    for (int i=0; i<3; i++) {
      float x, y;
      scanf("%f%f", &x, &y);
      xs[i] = x;
      ys[i] = y;
    }

    Line l1, l2;
    l1.a = xs[1]-xs[0];
    l1.b = ys[1]-ys[0];
    l1.c = -(xs[1]*xs[1]-xs[0]*xs[0] + ys[1]*ys[1]-ys[0]*ys[0])/2;
    l2.a = xs[2]-xs[1];
    l2.b = ys[2]-ys[1];
    l2.c = (xs[1]*xs[1]-xs[2]*xs[2] + ys[1]*ys[1]-ys[2]*ys[2])/2;
    Pair p = Intersect(l1, l2);
    double r = Dist(p, Pair(xs[0], ys[0]));
    p.first = int(p.first*1000+0.5)/1000.0;
    p.second = int(p.second*1000+0.5)/1000.0;
    r = int(r*1000+0.5)/1000.0;
    printf("%.3f %.3f %.3f\n", float(p.first), float(p.second), float(r));
  }
}

C++: #include <iostream>

using namespace std;

int main(void){
	int val;
	while(cin >> val)
		cerr << val << endl;

	return 0;
}

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

int main() {
	int n, i;
	double x[4], y[4], a[2], b[2], c[2], r;
	cin >> n;
	for (i = 0;i < n;i++) {
		cin >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

		a[0] = 2.0*(x[2] - x[1]);
		b[0] = 2.0*(y[2] - y[1]);
		c[0] = x[1] * x[1] - x[2] * x[2] + y[1] * y[1] - y[2] * y[2];
		a[1] = 2.0 * (x[3] - x[1]);
		b[1] = 2.0*(y[3] - y[1]);
		c[1] = x[1] * x[1] - x[3] * x[3] + y[1] * y[1] - y[3] * y[3];

		x[0] = (b[0] * c[1] - b[1] * c[0]) / (a[0] * b[1] - a[1] * b[0]);
		y[0] = (c[0] * a[1] - c[1] * a[0]) / (a[0] * b[1] - a[1] * b[0]);

		r = sqrt((x[1] - x[0])*(x[1] - x[0]) + (y[1] - y[0])*(y[1] - y[0]));
		printf("%.3f %.3f %.3f\n", x[0], y[0], r);
	}
}

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

#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); a2 = 2 * (x3 - x1);
    b1 = 2 * (y2 - y1); b2 = 2 * (y3 - y1);
    c1 = SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2);
    c2 = SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3);
    x = (b1 * c1 - b2 * c1) / (a1 * b2 - a2 * b1);
    y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    a = sqrt(SQ(x1 - x2) + SQ(y1 - y2));
    b = sqrt(SQ(x2 - x3) + SQ(y2 - y3));
    c = sqrt(SQ(x3 - x1) + SQ(y3 - y1));
    //    printf("a = %.3f b = %.3f c = %.3f\n", a, b, c);
    cos_a = (SQ(b) + SQ(c) - SQ(a)) / (2 * b * c);
    sin_a = sqrt(1 - SQ(cos_a));
    //    printf("cos_a = %.3f sin_a = %.3f\n", cos_a, sin_a);
    r = a / sin_a;
    r /= 2;
    printf("%.3f %.3f %.3f\n",x, y, r);
  }
  return 0;
}