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++: #include <iostream>
#include <stdio.h>
#include <string>
#include <queue>
#include <cmath>

#define int64 long long int

using namespace std;

double round(double x){
	if(x > 0) return floor(x + 0.5);
	else return -1.0 * floor(fabs(x) + 0.5);
}

int main()
{
	int n;
	double x1,y1,x2,y2,x3,y3,x,y,r;
	double det,a1,b1,a2,b2,c1,c2;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a1 = 2 * (x1 - x2), b1 = 2 * (y1 - y2);
		a2 = 2 * (x2 - x3), b2 = 2 * (y2 - y3);
		det = a1 * b2 - a2 * b1;
		c1 = (x1*x1 - x2*x2) + (y1*y1 - y2*y2);
		c2 = (x2*x2 - x3*x3) + (y2*y2 - y3*y3);
		x = (a1 * c1 + b1 * c2) / det;
		y = (a2 * c1 + b2 * c2) / det;
		r = sqrt((x - x1)*(x - x1) + (y - y1)*(y - y1));
		x *= 1000, y *= 1000, r *= 1000;
		x = round(x), y = round(y), r = round(r);
		x /= 1000, y /= 1000, r /= 1000;
		if(fabs(x) < 1e-6) x = 0.0;
		if(fabs(y) < 1e-6) y = 0.0;
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

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

int main()
{
  int n;

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

    double a1 = 2 * (x2 - x1);
    double b1 = 2 * (y2 - y1);
    double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;

    double a2 = 2 * (x3 - x1);
    double b2 = 2 * (y3 - y1);
    double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;

    double x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
    double y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    double r = hypot(x - x1, y - y1);

    printf("%.3f %.3f %.3f\n", x, y, r);
  }
}

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

#define pow2(x) ((x)*(x))

int main() {
	double x0, y0, x1, y1, X0, Y0, X1, Y1;
	double a1, b1, a2, b2, a3, b3;
	int n;
	cin >> n;
	while(n--) {
		cin >> a1 >> b1 >> a2 >> b2 >> a3 >> b3;
		x0 = (a1 + a2) / 2.0; y0 = (b1 + b2) / 2.0;
		x1 = -(b2 - b1); y1 = (a2 - a1);
		X0 = (a2 + a3) / 2.0; Y0 = (b2 + b3) / 2.0;
		X1 = -(b3 - b2); Y1 = (a3 - a2);
		double s = (Y1*(x0 - X0) - X1*(y0 - Y0)) / (X1*y1 - Y1*x1);
		double p = x0 + s * x1, q = y0 + s * y1;
		double r = sqrt(pow2(p - a1) + pow2(q - b1));
		printf("%.3f %.3f %.3f\n", p, q, r);
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
#define SQ(x) ((x) * (x))
typedef long long ll;
typedef pair<int, int> pii;

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define debug(x) cout << #x << ": " << x << endl
#define ALL(x) (x).begin(),(x).end()

const int INF = 1e9;
const ll LINF = 1e16;

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int s;
	int i;
	double x1, x2, x3;
	double y1, y2, y3;
	double a, b, c, d, e, f;
	double l, m, n;

	cin >> s;
	for (i = 0; i < s; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		a = (x1 - x2);
		b = (y1 - y2);
		c = -1 * (SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2));
		d = (x1 - x3);
		e = (y1 - y3);
		f = -1 * (SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3));

		l = (c * e - b * f) / (e * a - b * d);
		m = (d * c - a * f) / (d * b - e * a);

		n = -1 * (SQ(x1) + SQ(y1) + l * x1 + m * y1);

		printf("%.3f %.3f %.3f\n", l / -2.0, m / -2.0, sqrt(SQ(l) + SQ(m) - 4 * n) / 2.0);
	}

	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 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);}

/* }}} */

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 xA = x2 - x1, yA = y2 - y1, 
           xB = x3 - x1, yB = y3 - y1;
    double s = (xA * xB + yA * yB - xB * xB - yB * yB) / (xA * yB - xB * yA);
    s /= 2;
    double xO = xA / 2 + s * yA,
           yO = yA / 2 - s * xA;
    double r = sqrt(fabs(x1 - xO) * fabs(x1 - xO) + fabs(y1 - yO) * fabs(y1 - yO));
    printf("%f %f %f\n", xO, yO, r);
  }

  return (0);
}