402900: GYM100942 A Three seamarks

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Three seamarkstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

The "Victory" ship sailed away from the shore to participate in an international regatta. Having no positioning device onboard the ship went off the course and got lost in the seas. Luckily, the captain could see three seamarks through his binoculars with their coordinates known. As everyone knows, binoculars make it is possible not only to observe the objects, but also measure their angular sizes, i.e angles between straight lines connecting objects' corner points with an observing eye. For example, if two seamarks are located at points M1 and M2, and the ship is at point K, then the angular size of segment M1M2 is an angle M1KM2.

You need to find the ship's coordinates by given angular sizes of two segments connecting seamarks M1 and M2, M2 and M3.

Input

The first line contains an integer n — number of possible locations of the seamarks (1 ≤ n ≤ 50 000). Each of the next n lines contains eight integers. The first six integers describe Cartesian coordinates of different points M1, M2, M3 that do not exceed 10 000 by absolute value; the next two integers from the range [1; 179] are angular sizes (in degrees) of segments M1M2 and M2M3. It is guaranteed that the solution exists for each of the test cases.

Output

For each location of the seamarks output coordinates of any possible ship position separated by space in a separate line. The answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

ExamplesInput
1
0 0 2 0 2 2 90 90
Output
1.0000000000 1.0000000000

加入题单

上一题 下一题 算法标签: