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

namespace test
{
    class Program
    {


        static void Main(string[] args)
        {
            List<List<double>> resultList = new List<List<double>>();

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] inputArray = Console.ReadLine().Split(' ');

                resultList.Add(GetAnswer(inputArray));

            }

            foreach (List<double> list in resultList)
            {
                Console.WriteLine("{0:f3} {1:f3} {2:f3}", list[0], list[1], list[2]);
            }

        }

        static List<double> GetAnswer(string[] inputArray)
        {
            List<double> answer = new List<double>();

            double x1 = double.Parse(inputArray[0]);
            double y1 = double.Parse(inputArray[1]);
            double x2 = double.Parse(inputArray[2]);
            double y2 = double.Parse(inputArray[3]);
            double x3 = double.Parse(inputArray[4]);
            double y3 = double.Parse(inputArray[5]);

            double a, b, c, l, m, n;

            a = x2 * x2 + y2 * y2 - x1 * x1 - y1 * y1;
            b = x3 * x3 + y3 * y3 - x2 * x2 - y2 * y2;

            if (y2 != y3)
            {
                c = (y1 - y2) / (y2 - y3);

                l = (a - c * b) / (x1 - x2 - c * (x2 - x3));
                m = (b - l * (x2 - x3)) / (y2 - y3);
            }
            else
            {
                l = -x2 - x3;
                m = (a - (x1 - x2) * l) / (y1 - y2);
            }

            n = -x1 * l - y1 * m - x1 * x1 - y1 * y1;

            Console.WriteLine("{0:f3} {1:f3} {2:f3}", l,m,n);

            double x = -l / 2;
            double y = -m / 2;
            double r = Math.Sqrt(x * x + y * y - n);

            answer.Add(x);
            answer.Add(y);
            answer.Add(r);

            return answer;
        }

    }
}