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: Time Limit Exceeded)

#include<stdio.h>
#include<math.h>

int main()
{
	int n;
	int i;
	scanf("%d",&n);
	for(i=0;i<n;n++){
		double x1,y1,x2,y2,x3,y3;
		double a,b,c,d,e,f;
		double xm1,xm2,ym1,ym2;
		double r,rx,ry;
		scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
		xm1=(x1+x2)/2;
		ym1=(y1+y2)/2;
		xm2=(x3+x2)/2;
		ym2=(y3+y2)/2;
		c=y1-y2;
		d=x1-x2;
		e=y3-y2;
		f=x3-x2;
		if(c==0.0)
			a=0.0;
		else
		a=-d/c;
		if(e==0.0)
			b=0.0;
		else
		b=-f/e;
		if(c==0)
			rx=xm1;
		else if(d==0)
			ry=ym1;
		if(e==0)
			rx=xm2;
		else if(f==0)
			ry=ym2;
		else{
		rx=(a*xm1-b*xm2+ym2-ym1)/(a-b);
		ry=a*(rx-xm1)+ym1;
		}
		r=(rx-x1)*(rx-x1)+(ry-y1)*(ry-y1);
		r=sqrt(r);

		printf("%.3lf %.3lf %.3lf",rx,ry,r);


	}
	return 0;
}