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: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0010
{
    class Program
    {
        static void Main(string[] args)
        {
           
              
            int n = int.Parse(Console.ReadLine());
            double[] px = new double[n];
            double[] py = new double[n];
            double[] r = new double[n];
            for (int i = 0; i < n; i++)
            {
                double[] array = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
                double x1 = array[0];
                double y1 = array[1];
                double x2 = array[2];
                double y2 = array[3];
                double x3 = array[4];
                double y3 = array[5];
                double xx1 = array[0] * array[0];
                double yy1 = array[1] * array[1];
                double xx2 = array[2] * array[2];
                double yy2 = array[3] * array[3];
                double xx3 = array[4] * array[4];
                double yy3 = array[5] * array[5];

                px[i] = (2 * (y2 - y1) * (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3) - 2 * (y3 - y1) * (x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2)) / (2 * (x2 - x1) * 2 * (y3 - y1) - 2 * (x3 - x1) * 2 * (y2 - y1));
                py[i] = ((x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2) * 2 * (x3 - x1) - (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3) * 2 * (x2 - x1)) / (2 * (x2 - x1) * 2 * (y3 - y1) - 2 * (x3 - x1) * 2 * (y2 - y1));
                r[i] = Math.Sqrt((px[i] - x1) * (px[i] - x1) + (py[i] - y1) * (py[i] - y1));

                Console.WriteLine(px[i].ToString("f3") + " " + py[i].ToString("f3") + " " + r[i].ToString("f3"));

            }
        }
    }
}