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++: //ツ三ツ角ツ形ツづ個外ツ静堋円ツづ個陳?心ツづ? ツ三ツ角ツ形ツづ個静シツ閉ェツづ個青つ陳シツ禿アツ督卍閉ェツ静シツつェツ古ーツづュツづゥツ湘ェツ渉環づ可づ按づゥ.
//ツつアツづ個づヲツつ、ツづ按甘エツ可スツ学ツ的ツづ按姪「ツ妥ィツづーツ嘉ーツつュツづ?つォツづ? ツ暗按可コツづ個ペ-ツジツづ個δ可イツブツδ可δ環づーツ参ツ考ツづ可つキツづゥツづ?嘉ーツつォツづ「ツつキツつ「.
// - http://www.deqnotes.net/acmicpc/2d_geometry/
// - http://www.prefield.com/algorithm/index.html

#include <iostream>
#include <complex>
#include <vector>
#include <cstdio>
using namespace std;

typedef complex<double> P;

P p[3]; //ツ三ツ角ツ形ツづ個三ツ点

//ツ外ツ静?
double cross(const P &a, const P &b){
  return imag(conj(a) * b);
}

//ツ静シツ閉ェ/ツ陳シツ静シツ用ツづ個型
struct L : public vector<P> {
  L(const P &a, const P &b){
    push_back(a);
    push_back(b);
  }
};

//ツ陳シツ静シ2ツづつづ個古ーツ点ツづーツ仰?づ淞づゥ
P crosspoint(const L &l, const L &m){
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  return m[0] + B / A * (m[1] - m[0]);
}

//ツ静シツ閉ェabツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづーツ仰?づ淞づゥ
L getBisection(const P &a, const P &b){
  P s = (a + b) / 2.0; //ツ陳?点
  P t = (b - a) * P(0, 1); //ツ静シツ閉ェabツづ個法ツ静シツベツクツトツδ仰づーツ偲ヲツ督セ

  //ツ静シツ閉ェabツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづ? ツ点sツつゥツづァs+tツづ鳴伸ツづ堕づゥツ陳シツ静シ
  return L(s, s + t);
}

void solve(){
  //ツ三ツ角ツ形ツづ個静シツ閉ェツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづー2ツづつ偲ヲツ督セツつキツづゥ
  L l1 = getBisection(p[0], p[1]);
  L l2 = getBisection(p[1], p[2]);

  //ツ外ツ静堋円ツづ個陳?心ツづ? l1ツづ?2ツつェツ古ーツ債キツつオツつスツ点
  P o = crosspoint(l1, l2);

  //ツ三ツ角ツ形ツづ個任ツ暗督づ個陳クツ点ツつゥツづァ, ツ陳?心ツづ慊づ?づ個仰猟猟」ツづーツ偲ヲツづェツづ? ツ板シツ径ツづ可づ按づゥ
  printf("%.3f %.3f %.3f\n", o.real(), o.imag(), abs(o - p[0]));
}

int main(){
  int n;
  cin >> n;

  for(int i = 0; i < n; i++){
    for(int j = 0; j < 3; j++){
      cin >> p[j].real() >> p[j].imag();
    }

    solve();
  }
}

C++: #include<iostream>
#include<iomanip>
#include<memory>
#include<array>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>

using namespace std;

int main()
{
  int n;
  array<double, 3> x;
  array<double, 3> y;
  array<double, 2> a;
  array<double, 2> b;
  array<double, 2> c;
  double cx, cy, r;

  cin >> n;
  for ( int j = 0; j < n; j++ )
    {
      for ( auto i = 0; i < x.size(); i++ )
        {
          cin >> x[i];
          cin >> y[i];
        }
      
      for ( auto i = 0; i < a.size(); i++ )
        {
          a[i] =  y[i+1] - y[i];
          b[i] =  x[i+1] - x[i];
          c[i] = (x[i+1] * x[i+1] - x[i] * x[i]) * 0.5 + (y[i+1] * y[i+1] - y[i] * y[i]) * 0.5;
        }
      
      cx = (b[1] * c[0] - b[0] * c[1]) / (a[0] * b[1] - a[1] * b[0]);
      cy = (a[0] * c[1] - a[1] * c[0]) / (a[0] * b[1] - a[1] * b[0]);
      r = sqrt( (x[0] - cx) * (x[0] - cx) + (y[0] - cy) * (y[0] - cy) );
      
      cout << fixed << setprecision(3) << cx << " " << cy << " " << r << endl;
    }
  return 0;
}

C++: #include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(3); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

template <typename T>
struct Matrix {
  vector<vector<T>> v;
  int r, c;
  Matrix(int r, int c, T d) : r(r), c(c) {
    v = vector<vector<T>>(r, vector<T>(c, d));
  }
  Matrix(vector<vector<T>> v) : v(v) {
    r = v.size();
    c = v[0].size();
  }
  vector<T>& operator[](int x) {
    return v[x];
  }
  Matrix<T> operator*=(Matrix<T> that) {
    assert(c == that.r);
    auto ret = Matrix<T>(r, that.c, 0);
    rep(i, r) rep(j, that.c) rep(k, c) {
      ret[i][j] += v[i][k] * that[k][j];
    }
    return *this = ret;
  }
  Matrix<T> operator*(Matrix<T> that) {
    return *this *= that;
  }
  Matrix<T> pow(i64 n) {
    assert(r == c);
    auto e = Matrix<T>(r, c, 0);
    rep(i, r) e[i][i] = 1;
    return power(*this, n, e);
  }
};

void solve() {
  function<f80(f80)> rnd = [](f80 x) {
    return round(x * 1000) / 1000;
  };
  int n; cin >> n;
  while (n--) {
    f80 x[3], y[3];
    rep(i, 3) cin >> x[i] >> y[i];
    auto a = Matrix<f80>({{
      - power(x[0], 2) - power(y[0], 2),
      - power(x[1], 2) - power(y[1], 2),
      - power(x[2], 2) - power(y[2], 2),
    }});
    f80 r = 1 / (
      x[0]*y[1] + x[1]*y[2] + x[2]*y[0] - x[2]*y[1] - x[1]*y[0] - x[0]*y[2]
    );
    auto xx = Matrix<f80>({
      { y[1] - y[2], x[2] - x[1], x[1]*y[2] - x[2]*y[1] },
      { y[2] - y[0], x[0] - x[2], x[2]*y[0] - x[0]*y[2] },
      { y[0] - y[1], x[1] - x[0], x[0]*y[1] - x[1]*y[0] },
    });
    rep(i, 3) rep(j, 3) xx[i][j] *= r;
    auto ans = a * xx;

    auto p = -ans[0][0] / 2;
    auto q = -ans[0][1] / 2;
    auto s = sqrt(power(p, 2) + power(q, 2) - ans[0][2]);
    cout << p << " " << q << " " << s << '\n';
  }
}