Two Triangles in 3D

There is a red triangle and a blue triangle in 3D space. When looking from the top (from +z to XY plane), how much red and how much blue would be seen? (Assume you are seeing both the triangles clearly from an infinite distance) The triangles are opaque so they can block each other. For example, if the red one is (0,0,0), (3,0,0) and (1,3,0), the blue one is (0,0,1), (3,0,1) and (1,3,1) (See the figure on the right). When looking from the top, both becomes (0,0), (3,0), (1,3), but you can only see the blue one. This figure corresponds to the 3rd sample input. Input The first line contains the number of test cases T (1 ≤ T ≤ 3000). Each test case contains two lines. Each line contains 9 integers to describe a triangle: x1 y1 z1 x2 y2 z2 x3 y3 z3 (0≤xi,yi,zi ≤100). The first line describes the red one, and the second line the blue one. Each triangle is guaranteed to have a strictly positive area. They would never lie on the same plane (As in that case you can’t tell which one blocks the other). Output For each test case, print two real numbers, the red area and the blue area that can be seen, rounded to 4 decimal places. Absolute errors less than 1.1 ∗ 10−4 will definitely be ignored. Explanation of sample: In the first and third case, the red triangle is completely blocked by the blue one. In the second case, two triangles intersect, each is divided into two parts. Sample Input 3 000100010 001101011 000101010 100001110 000300130 001301131

2/2 Sample Output 0.0000 0.5000 0.3750 0.3750 0.0000 4.5000