Problem:
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Circumscribed Circle of A Triangle.

Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface.

Input

Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:

$x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$

in a line. All the input are real numbers.

Output

For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places.

Constraints

$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$

$ n \leq 20$

Sample Input

1
0.0 0.0 2.0 0.0 2.0 2.0

Output for the Sample Input

1.000 1.000 1.414

Solution in JavaScript (judge verdict: Wrong Answer)

//config = { input: 'tmp', newline: '\r\n' }; // win
config = { input: '/dev/stdin', newline: '\n' }; // linux

line = require('fs').readFileSync(config.input, 'ascii').trim()
	.split(config.newline);
line.shift();
line.forEach(calc);

function calc(line) {
	var a = line.split(' ').map(Number);
	console.log(line);
	var l1 = get_midperpendicular(a[0], a[1], a[2], a[3]);
	var l2 = get_midperpendicular(a[0], a[1], a[4], a[5]);
	var p = get_intersection_point(l1, l2);
	var r = Math.sqrt(sqr(p.x - a[0]) + sqr(p.y - a[1]));
	console.log('%s %s %s', format(p.x), format(p.y), format(r));
}

function get_midperpendicular(x1, y1, x2, y2) {
	return { a: 2 * (y2 - y1), b: 2 * (x2 - x1),
		c: (y2 - y1) * (y2 + y1) + (x2 - x1) * (x2 + x1) };
}

function get_intersection_point(l1, l2) {
	var det = l1.a * l2.b - l1.b * l2.a;
	var x = (l2.b * l1.c - l1.b * l2.c) / det;
	var y = (-l2.a * l1.c + l1.a * l2.c) / det;
	return {x: x, y: y};
}

function sqr(x) { return x * x; }

function format(x) {
	var ary = x.toFixed(4).split('\.');
	if (ary.length === 1) return ary[0] + '.000';
	var decimal_part = (ary[1] + '000').slice(0, 3);
	return ary[0] + '.' + decimal_part;
}