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 C# (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;

namespace _010_CircumscribedCircleofaTriangle
{
	class Program
	{
		static void Main ( string[] args )
		{
			int dataSetCount = int.Parse ((Console.ReadLine ()));

			for (int lp = 0; lp < dataSetCount; lp++)
			{
				double[] points = Console.ReadLine ().Split (' ').Select (str => double.Parse (str)).ToArray ();

				double[] point1 = points.Take (2).ToArray ();
				double[] point2 = points.Skip (2).Take (2).ToArray ();
				double[] point3 = points.Skip (4).Take (2).ToArray ();

				double[] equation1 = GenerateEquation (point1, point2);
				double[] equation2 = GenerateEquation (point1, point3);

				double[] centerPoint = SimultaneousEquation (equation1, equation2);

				double radius =
					Math.Sqrt (
					(centerPoint[0] - point1[0]) * (centerPoint[0] - point1[0]) +
					(centerPoint[1] - point1[1]) * (centerPoint[1] - point1[1]));

				Console.WriteLine ("{0:0.000} {1:0.000} {2:0.000}", centerPoint[0], centerPoint[1], radius);
			}
		}

		static double[] GenerateEquation ( double[] numArray, double[] numArray2 )
		{
			double a = 0;

			if (numArray2[0] - numArray[0] != 0)
				a = (numArray2[1] - numArray[1]) / (numArray2[0] - numArray[0]) * -1;

			double x = (numArray[0] + numArray[1]) / 2;
			double y = (numArray2[0] + numArray2[1]) / 2;

			double b = a * -x + y;

			double[] answer = { -a, 1, b };
			return answer;
		}

		static double[] SimultaneousEquation ( double[] numArray, double[] numArray2 )
		{
			double a = numArray[0];
			double b = numArray[1];
			double c = numArray[2];
			double d = numArray2[0];
			double e = numArray2[1];
			double f = numArray2[2];

			double divide = (a * e - b * d);
			double X = (double) (e * c - b * f) / divide;
			double Y = (double) (a * f - d * c) / divide;

			double[] answer = { X, Y };
			return answer;
		}
	}
}