| Cataratas do Pinhão 2025 |
|---|
| Finished |
Ebert is the best student in Linear Algebra VII in his class, so his mathematical knowledge is quite extensive. As a result, after a mind-boggling test on the subject, several students asked him how he had answered a certain question on the test. This question involved planes in a 4-dimensional space, and Ebert, with all his wisdom, explained that the intersection of two planes in $$$\mathbb{R}^4$$$ can be a single point. "It's too trivial to notice that!" exclaimed Ebert, demonstrating the planes with his own hands.
Now, several students started asking Ebert for help, but they were so annoying that he decided he didn't want to waste any more time on it. But, since he's a nice guy, he decided to ask you to write a program that would solve the problem for him, so he could just run the program. Help Ebert find the coordinates of the intersections!
The first line of input consists of an integer $$$T$$$ ($$$1 \leq T \leq 10^{4}$$$), the number of test cases. Each test case has six lines, each containing four integers $$$X_i, Y_i, Z_i$$$ and $$$W_i$$$ ($$$-10000 \leq X_i, Y_i, Z_i, W_i \leq 10000$$$).
The first line of each test case represents the displacement vector $$$A = (X_1, Y_1, Z_1, W_1)$$$. The second and third lines represent the direction vectors $$$B = (X_2, Y_2, Z_2, W_2)$$$ and $$$C = (X_3, Y_3, Z_3, W_3)$$$, respectively.
The fourth line represents the displacement vector $$$D = (X_4, Y_4, Z_4, W_4)$$$. The fifth and sixth lines represent the direction vectors $$$E = (X_5, Y_5, Z_5, W_5)$$$ and $$$F = (X_6, Y_6, Z_6, W_6)$$$, respectively.
The first plane is defined by $$$A + u_1B + v_1C$$$, where $$$u_1$$$ and $$$v_1$$$ are real numbers. The second plane is defined by $$$D + u_2E + v_2F$$$, where $$$u_2$$$ and $$$v_2$$$ are real numbers.
It is guaranteed that the planes are not degenerate, i.e., the pairs $$$B$$$ and $$$C$$$ and $$$E$$$ and $$$F$$$ are linearly independent.
For each test case, if there is a unique intersection between the two planes, print a line containing four real numbers representing the values $$$u_1, v_1, u_2, v_2$$$. Otherwise, print only the value $$$-1$$$.
Your answer will be considered correct if the absolute or relative error is less than $$$10^{-6}$$$. That is, if your answer is $$$a$$$ and the correct answer is $$$b$$$, then the judge will accept your answer if $$$|a - b| \leq 10^{-6} \cdot \max(1, |b|)$$$.
10 0 0 01 0 0 00 1 0 00 0 0 00 0 1 00 0 0 1
0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000
24 9 2 00 9 4 22 8 1 28 7 4 91 0 0 05 8 2 15 5 5 51 4 2 73 7 6 24 8 3 07 4 14 72 4 4 9
4.476190476190476 5.333333333333333 46.428571428571429 -10.619047619047619 -1
| Name |
|---|


