Linear Fractional Transformation
题号:NC230864
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
Special Judge, 64bit IO Format: %lld

题目描述

The linear fractional transformations are the functions mapping the extended complex plane onto itself.

Given , and , where z_1, z_2 and z_3 are pairwise distinct complex numbers and w_1, w_2 and w_3 are also pairwise distinct complex numbers, your task is to calculate f(z_0) for a certain complex number z_0. It can be shown that the answer is always unique to the given contraints.

输入描述:

The input contains several test cases, and the first line contains an integer T , indicating the number of test cases.

To clarify the input format, we denote , , , , , and , where i is the imaginary unit that .

Then for each test case, the first line contains four integers p_1, q_1, r_1 and s_1, the second contains four integers p_2, q_2, r_2 and s_2, the third line contains four integers p_3, q_3, r_3 and s_3, and the fourth line contains only two integers p_0 and q_0. It is guaranteed that all these integers are in the range and the answer f(z_0) satisfies , where is the modulus of the complex number z.

输出描述:

For each test case, output a line containing two real numbers c_0 and d_0, indicating the real part and the imaginary part of f(z_0).

Your answer is acceptable if the absolute or relative errors of both the real part and the imaginary part do not exceed . Formally speaking, suppose that your output is x and the jury's answer is y, your output is accepted if and only if .
示例1

输入

复制
2
-1 0 0 -1
0 1 -1 0
1 0 0 1
0 -1
-1 0 -1 0
0 1 0 -1
1 0 1 0
0 -1

输出

复制
1.000000000000000 0.000000000000000
0.000000000000000 1.000000000000000

说明

In the first sample case we have f(z)=iz, and in the second sample case we have f(z)=1/z.