Contraband

No attempts yetTime limit1sMemory limit128 MB

Problem

Someone reported that an aircraft approaching the airport dropped an object while crossing the bay. The police think the object was contraband left for a confederate to pick up, so they want to watch every aircraft that could have dropped it whenever one approaches the airport over the bay again. Three observation stations around the bay have night vision equipment.

Place station 0 at the origin, with xx measured east and yy measured north. Station 1 is 3.715 km east and 1.761 km north of station 0, and station 2 is 2.894 km east and 2.115 km south of station 0. Every distance is in kilometers.

Stationxxyy
00.0000.000
13.7151.761
22.894-2.115

When a suspect aircraft crosses the bay, the three observers stay in contact and follow it with the night vision equipment. An observer who sees something fall records a direction to the object and a confidence level for that direction. The confidence level CLCL is a value from 0 to 1. A value of 0 means the observer was more or less pointing at the aircraft, and 1 means the observer was pointing at the splash where the object hit the water.

The three sight lines usually miss a common point and form a triangle instead. The estimate of the actual position is the point (x,y)(x, y) that minimizes the squared distance did_i to each line, weighted by CLi+0.2CL_i + 0.2:

i=02(CLi+0.2)di2\sum_{i=0}^{2} (CL_i + 0.2) \, d_i^2

Sight line ii passes through station ii along the direction that observer recorded, and did_i is the perpendicular distance from (x,y)(x, y) to that line. Treat a sight line as a full line extending both ways, not a ray.

Given the three directions and the three confidence levels, write a program that computes the point (x,y)(x, y) minimizing the sum above.

Input

The first line contains the number of data sets PP (1P1000)(1 \le P \le 1000). Each of the next PP lines holds one data set, and every data set is processed the same way and independently.

A data set is a single line: the data set number NN, then six space separated floating point values, in the order a0a_0, CL0CL_0, a1a_1, CL1CL_1, a2a_2, CL2CL_2. aia_i is the bearing measured at station ii in degrees clockwise from north (0ai<360)(0 \le a_i < 360). CLiCL_i is the confidence level of observer ii (0CLi1)(0 \le CL_i \le 1).

No input has all three sight lines pointing along parallel directions, so the minimizing point is always unique.

Output

Print one line for each data set. Each line holds the data set number NN exactly as it was given, one space, then xx and yy separated by a space. xx is the distance east of station 0 and yy is the distance north (positive) or south (negative) of station 0, both in kilometers.

Round xx and yy to three decimal places and always print all three digits. Both coordinates sit at least 10510^{-5} away from a rounding boundary, so no input leaves the rounding direction ambiguous. A coordinate that rounds to zero is printed as 0.000, never -0.000.