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.Text;

namespace _010_CircumscribedCircleofaTriangle
{
	class Program
	{
		static void Main ( string[] args )
		{
			int dataSetCount = int.Parse ((Console.ReadLine ()));
			StringBuilder output = new StringBuilder (dataSetCount * 5 * 3);

			for (int lp = 0; lp < dataSetCount; lp++)
			{
				decimal[] points = Array.ConvertAll (Console.ReadLine ().Split (' '), decimal.Parse);

				Vector2 vertex1 = new Vector2 (points[0], points[1]);
				Vector2 vertex2 = new Vector2 (points[2], points[3]);
				Vector2 vertex3 = new Vector2 (points[4], points[5]);

				decimal edge1 = (vertex1 - vertex2).Length ();
				decimal edge2 = (vertex1 - vertex3).Length ();
				decimal edge3 = (vertex2 - vertex3).Length ();

				edge1 = edge1 * edge1;
				edge2 = edge2 * edge2;
				edge3 = edge3 * edge3;

				decimal area =
					edge1 * (edge2 + edge3 - edge1) +
					edge2 * (edge3 + edge1 - edge2) +
					edge3 * (edge1 + edge2 - edge3);

				Vector2 circlePoint =
					 edge1 * (edge2 + edge3 - edge1) * vertex1 +
					 edge2 * (edge3 + edge1 - edge2) * vertex2 +
					 edge3 * (edge1 + edge2 - edge3) * vertex3 / area;

				decimal radius = (circlePoint - vertex1).Length ();

				output.AppendFormat ("{0:0.000} {1:0.000} {2:0.000}", circlePoint.X, circlePoint.Y, radius);
				output.AppendLine ();
			}

			Console.Write (output);
		}
	}

	class Vector2
	{
		public Vector2 ( decimal x, decimal y )
		{
			this.X = x;
			this.Y = y;
		}

		public decimal X { private set; get; }
		public decimal Y { private set; get; }

		public static Vector2 operator + ( Vector2 ob1, Vector2 ob2 )
		{
			return new Vector2 (ob1.X + ob2.X, ob1.Y + ob2.Y);
		}
		public static Vector2 operator - ( Vector2 ob1, Vector2 ob2 )
		{
			return new Vector2 (ob1.X - ob2.X, ob1.Y - ob2.Y);
		}
		public static Vector2 operator * ( decimal scalar, Vector2 ob )
		{
			return new Vector2 (ob.X * scalar, ob.Y * scalar);
		}
		public static Vector2 operator / ( Vector2 ob, decimal scalar )
		{
			return new Vector2 (ob.X / scalar, ob.Y / scalar);
		}
		private static decimal Sqrt ( decimal number )
		{
			return new decimal (Math.Sqrt (decimal.ToDouble (number)));
		}
		public decimal Length ()
		{
			return Sqrt (X * X + Y * Y);
		}
	}
}