Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

double roundp(double x, int p) {
  double t = pow(10, p);
  return double((int) (x * t + 0.5)) / t;
}

template<typename T>
constexpr T det2(const T &a1, const T &a2, const T &b1, const T &b2) {
  return a1 * b2 - b1 * a2;
}

void solve() {
  int n;
  cin >> n;
  rep(i, n) {
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double d1 = x1 * x1 + y1 * y1, d2 = x2 * x2 + y2 * y2, d3 = x3 * x3 + y3 * y3;
    double npx = det2(d1, d2, y1, y2) + det2(d2, d3, y2, y3) + det2(d3, d1, y3, y1);
    double npy = det2(d2, d1, x2, x1) + det2(d3, d2, x3, x2) + det2(d1, d3, x1, x3);
    double dp  = 2 * (det2(x1, x2, y1, y2) + det2(x2, x3, y2, y3) + det2(x3, x1, y3, y1));
    double px = npx / dp, py = npy / dp;
    double r = hypot(px - x1, py - y1);
    printf("%.3f %.3f %.3f\n", px, py, r);
  }
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>
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 << fixed << std::setprecision(3);
        cout << p1 << " " << p2 << " " << r << endl;;
    }
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main()
{
    double x1,y1,x2,y2,x3,y3;
    int n;cin>>n;
    while(n--)

    {
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
         double  d1 = x1*x1+y1*y1;
      double  d2 = x2*x2+y2*y2;
      double  d3 = x3*x3+y3*y3;
      double  u = 0.5/(x1*y2-x2*y1+x2*y3-x3*y2+x3*y1-x1*y3);
      double  xp = u*(d1*y2-d2*y1+d2*y3-d3*y2+d3*y1-d1*y3);
      double  yp = u*(x1*d2-x2*d1+x2*d3-x3*d2+x3*d1-x1*d3);
      double  r = sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));
      printf("%.3f %.3f %.3f\n",xp,yp,r);
    }



    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <queue>
#include <cmath>

#define int64 long long int

using namespace std;

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));
		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++: //
//  main.cpp
//  adsfdsgsg
//
//  Created by h3037175 on 2017/07/31.
//  Copyright ?? 2017??´ h3037175. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <math.h>
#include<algorithm>
#include <utility>
#define nan -100000
using namespace std;
bool isY(double y1,double y2,double y3){
    if(y1==y2 || y1==y3 || y2==y3 ){
        return true;
    }
    else {
        return false;
    }
}
bool isX(double x1,double x2,double x3){
    if(x1==x2 || x1==x3 || x2==x3 ){
        return true;
    }
    else {
        return false;
    }
}
int main() {
    int n;
    double a,x1,x2,x3,y1,y2,y3,px,py,r;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        double X[3]={x1,x2,x3},Y[3]={y1,y2,y3};
        sort(X,X+3);sort(Y,Y+3);
        px=(X[2]-X[0])/2;
        py=(Y[2]-Y[0])/2;
            r=sqrt(px*px+py*py);
        printf("%.3f %.3f %.3f",px,py,r);
        cout<<endl;
    }
    return 0;
}
//3633
/*
 
 
 
 
                                  /
                                 /|
                                / |
                               /  |
                              /   |
                             /    |
                            / |   |
                           /  |   |
                          /   |   |
                         /    |   |
                        /     |   |
                       /      |   |
                      /       |   |
                     /-------------








*/

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		double x[3], y[3];
		for (int j = 0; j < 3; ++j)
			scanf("%lf %lf", x+j, y+j);
		
		double a[2], b[2];
		for (int j = 0; j < 2; ++j)
		{
			a[j] = -(x[2]-x[j])/(y[2]-y[j]);
			b[j] = (y[2]+y[j] - (x[2]+x[j])*a[j])/2;
		}
		double px = (b[0]-b[1])/(a[1]-a[0]);
		double py = a[0] * px + b[0];
		double r = sqrt((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0]));
		printf("%f %f %f\n", px, py, r);
	}

	return 0;
}

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

using namespace std;

int n;
int tx1, ty1, tx2, ty2, tx3, ty3;

int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> tx1 >> ty1;
		cin >> tx2 >> ty2;
		cin >> tx3 >> ty3;

		double mx1 = (tx1 + tx2) / 2.0;
		double my1 = (ty1 + ty2) / 2.0;
		double a1 = (double)(tx2 - tx1);
		double b1 = (double)(ty2 - ty1);
		double c1 = a1 * mx1 + b1 * my1;

		double mx2 = (tx2 + tx3) / 2.0;
		double my2 = (ty2 + ty3) / 2.0;
		double a2 = (double)(tx3 - tx2);
		double b2 = (double)(ty3 - ty2);
		double c2 = a2 * mx2 + b2 * my2;

		double det = a1 * b2 - a2 * b1;
		
		double cx = (b2 * c1 - a2 * c2) / det;
		double cy = (-a2 * c1 + a1 * c2) / det;
		
		double dx = cx - tx1;
		double dy = cy - ty1;
		double r = sqrt(dx*dx + dy*dy);
		
		printf("%.3f %.3f %.3f\n", cx, cy, r);
	}
}