409248: GYM103466 K Triangle
Description
One day, ABC and DD found a triangular wheat field, and they decide to cut it into two pieces with the same area with a segment. Because of various reasons, one of the endpoints of the division line is fixed at $$$(p_x, p_y)$$$. Now you are asked to find the other endpoint of the segment.
If the given endpoint does not lie on the boundary of the wheat field, the problem should be regarded as invalid. The other endpoint required should also locate on the boundary.
InputThe input provides several test cases and the first line of the input contains a single integer $$$T~(1 \le T \le 10^6)$$$ indicating the number of cases.
For each test case, eight integers $$$x_1,y_1,x_2,y_2,x_3,y_3,p_x$$$ and $$$p_y$$$ are given in a line, where $$$(x_1,y_1),(x_2,y_2)$$$ and $$$(x_3,y_3)$$$ describe the coordinates of vertices for the given triangle wheat field which are guaranteed to be not colinear, and $$$(p_x,p_y)$$$ is the given endpont of the segment. All coordinates are integers in the range $$$[0,10^5]$$$.
OutputFor each test case, output the coordinate of the other endpoint of the division segment, or output the number -1 if the problem, in this case, is invalid.
Formally, if your answer is $$$a$$$ and the jury's answer is $$$b$$$, then your answer will be considered correct if and only if $$$\frac{|a - b|}{\max\{1, |b|\}} \le 10^{-6}$$$.
ExampleInput2 0 0 1 1 1 0 1 0 0 0 1 1 1 0 2 0Output
0.500000000000 0.500000000000 -1