Triangle to Hexagon

Given triangle coordinates, find where the angle bisectors meet the circumcircle, intersect those lines with the sides, and print six segment lengths.

Medium7GeometryMathImplementationBrute forceNo attempts yetTime limit2sMemory limit512 MB

Problem

Let II be the incenter of triangle ABCABC and let OO be its circumscribed circle. The lines AIAI, BIBI and CICI meet the circle OO a second time at MM, NN and PP respectively.

Let EE and FF be the points where the line NPNP meets the sides ABAB and ACAC. In the same way, let GG and HH be the points where the line MNMN meets ACAC and BCBC, and let JJ and KK be the points where the line MPMP meets BCBC and ABAB.

Read the coordinates of the vertices AA, BB and CC, then print the lengths of the segments EFEF, FGFG, GHGH, HJHJ, JKJK and KEKE. The inequality EF+GH+JKKE+FG+HJ|EF| + |GH| + |JK| \le |KE| + |FG| + |HJ| is known to hold, so you can use it to check your own numbers.

Do the computation in double precision floating point.

Input

The first line contains one integer PP, the number of data sets (1P100001 \le P \le 10000). Every data set is processed the same way and independently of the others.

Each data set is a single line. The line holds the data set number KK followed by three floating point values separated by spaces: the xx coordinate of BB, BxB_x, the xx coordinate of CC, CxC_x, and the yy coordinate of CC, CyC_y. AA is always the origin (0,0)(0, 0) and BB always lies on the xx axis, so By=0B_y = 0.

KK is an integer, 0<Bx10000 < B_x \le 1000, Cx1000|C_x| \le 1000 and 0<Cy10000 < C_y \le 1000. The three points are never collinear.

Output

Print one line per data set. The line holds the data set number KK, then the lengths of EFEF, FGFG, GHGH, HJHJ, JKJK and KEKE in that order, each rounded to 4 decimal places and separated by a single space.