Brocard Point of a Triangle

Given the vertices of a counter-clockwise triangle, compute the coordinates of its Brocard point rounded to five decimals.

Medium7GeometryMathNo attempts yetTime limit1sMemory limit256 MB

Problem

The Brocard point of a triangle ABCABC is the point PP inside the triangle with PAB=PBC=PCA\angle PAB = \angle PBC = \angle PCA. See the figure below.

The size the three angles share is called the Brocard angle. The Brocard angle is at most π/6\pi/6, and that maximum occurs for an equilateral triangle. The Brocard point of an equilateral triangle is its centroid.

Given the coordinates of the three vertices, write a program that computes the coordinates of the Brocard point.

Input

The first line contains the number of data sets PP (1P100001 \le P \le 10000). The data sets are independent and every one is processed the same way.

Each data set is a single line. The line begins with the data set number KK, followed by the coordinates AxA_x, AyA_y, BxB_x, ByB_y, CxC_x, CyC_y of the three vertices, separated by spaces. KK is an integer between 11 and PP. Each coordinate is a real number whose absolute value is at most 10001000.

The vertices are always given so that going from AA to BB, from BB to CC, and from CC back to AA circles the triangle counter-clockwise. The three points are never collinear.

Output

Print one line for each data set. Print the data set number KK, a space, the xx coordinate of the Brocard point, a space, and the yy coordinate of the Brocard point.

Round both coordinates to five decimal places. If a rounded coordinate is zero, print 0.00000 and never -0.00000.