Go: package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n := r.nextInt()

	type Vec struct {
		x, y float64
	}
	vec := func(a, b Vec) Vec { return Vec{b.x - a.x, b.y - a.y} }
	unv := func(a Vec) Vec { return Vec{-a.y, a.x} }
	cdot := func(a, b Vec) float64 { return a.x*b.x + a.y*b.y }
	times := func(t float64, a Vec) Vec { return Vec{t * a.x, t * a.y} }
	add := func(a, b Vec) Vec { return Vec{a.x + b.x, a.y + b.y} }
	for i := 0; i < n; i++ {

		r.Scan(true)
		nextFloat64 := func() (ret float64) { fmt.Sscanf(r.nextString(), "%f", &ret); return }
		a1, a2, a3 := Vec{nextFloat64(), nextFloat64()}, Vec{nextFloat64(), nextFloat64()}, Vec{nextFloat64(), nextFloat64()}
		unv23 := unv(vec(a2, a3))
		v12 := vec(a1, a2)
		v31 := vec(a3, a1)
		s := cdot(v12, v31) / 2 / cdot(v12, unv23)
		c := add(times(.5, add(a2, a3)), times(s, unv23))
		v1c := vec(a1, c)
		fmt.Fprintf(stdout, "%.3f %.3f %.3f\n", c.x, c.y, math.Sqrt(v1c.x*v1c.x+v1c.y*v1c.y))
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#ifndef typeof
#define typeof __typeof__
#endif // typeof

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); i++)
#define repby(i, a, b, step) for(typeof(b) i = (a); i < (b); i += (step))
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

typedef pair<double, double> point;

struct line { // y = inc*x + c
  double inclination;
  double constant;
  bool xf; // if 0: y = c;
  bool yf; // if 0: x = c;
  line(double i, double c) : inclination(i), constant(c), xf(true), yf(true) {}
  line(double c, bool x, bool y) : constant(c), xf(x), yf(y) {}
};

double line_const(double inc, point &p) {
 return p.second - inc * p.first;
}

line make_line(point &p1, point &p2) {
  double inc;

  if (p2.first == p1.first)
    return line(p2.first, true, false);

  if (p2.second == p1.second)
    return line(p2.second, false, true);

  inc = (p2.second - p1.second) / (p2.first - p1.first);
  return line(inc, line_const(inc, p1));
}

line diagonal_line(line &l, point &p) {
  if (l.xf && l.yf) {
    double inc = -l.inclination;
    return line(inc, line_const(inc, p));
  } else {
    if (l.xf) {
      return line(p.second, false, true);
    } else {
      return line(p.first, true, false);
    }
  }
}

point middle_point(point &p1, point &p2) {
  double mx = (p1.first + p2.first) / 2;
  double my = (p1.second + p2.second) / 2;
  return point(mx, my);
}

point intersection_const(line l, line c)
{
  if (c.xf) {
    double x = c.constant;
    double y = l.inclination * x + l.constant;
    return point (x, y);
  } else {
    double y = c.constant;
    double x = (y - l.constant) / l.inclination;
    return point (x, y);
  }
}
point intersection(line l1, line l2)
{
  // y = inc1 * x + con1
  // y = inc2 * x + con2
  // inc2 * x + con2 = inc1 * x + con1
  if (l1.xf && l1.yf && l2.xf && l2.yf) {
    if (l2.inclination == l1.inclination) {
      cerr << "Error: Input is not a triangle" << endl;
      return point(0,0);
    }

    double x = (l1.constant - l2.constant) / (l2.inclination - l1.inclination);
    double y = l1.inclination * x + l1.constant;
    return point(x, y);
  } else if (l1.xf && l1.yf) { // l2: x = c || y = c
    return intersection_const(l1, l2);
  } else if (l2.xf && l2.yf) {
    return intersection_const(l2, l1);
  } else {
    if (l1.xf) {
      return point(l1.constant, l2.constant);
    } else {
      return point(l2.constant, l1.constant);
    }
  }
}

double point_distance(point p1, point p2)
{
  return sqrt(pow(p2.first - p1.first, 2) + pow(p2.second - p1.second, 2));
}

double round_to(double x, int decimal_digit)
{
  ll xll = ll(x * pow(10, decimal_digit+1));
  xll = (xll + 5) / 10;
  return double(xll) / pow(10, decimal_digit);
}

#define dbg(i) cout << #i << " " << i << endl;
void pcircle(point p1, point p2, point p3)
{
  line line12 = make_line(p1, p2);
  line line23 = make_line(p2, p3);
  point m12 = middle_point(p1, p2);
  point m23 = middle_point(p2, p3);
  line diag_line12 = diagonal_line(line12, m12);
  line diag_line23 = diagonal_line(line23, m23);

  point its = intersection(diag_line12, diag_line23);
  cout.setf(ios::fixed);
  cout.precision(3);
  cout << round_to(its.first, 3) << " " << round_to(its.second, 3) << " ";
  cout << round_to(point_distance(its, p1), 3) << endl;
}

int main(int argc, char **argv)
{
  int n;
  double a, b, c, d, e, f;

  cin >> n;
  while (n--) {
    cin >> a >> b >> c >> d >> e >> f;
    pcircle(point(a, b), point(c, d), point(e, f));
  }

  return 0;
}