Limits 1s, 512 MB

Don't waste your time on the title. You will be given two vectors v1=x1i^+y1j^\vec{v_{1}} = x_{1} \hat{i} + y_{1} \hat{j} and v2=x2i^+y2j^\vec{v_{2}} = x_{2} \hat{i} + y_{2} \hat{j}. Let v1\vec{v_{1}} and v2\vec{v_{2}} form angles θ1\theta_{1} and θ2\theta_{2} with the positive xx - axis respectively. Note that the magnitude of xii^+yij^x_{i} \hat{i} + y_{i} \hat{j} is defined by xi2+yi2\sqrt{x_{i}^2 + y_{i}^2}.

We expect a third vector v=xi^+yj^\vec{v} = x \hat{i} + y \hat{j} from you. And you have to make sure 2 properties of v\vec{v}.

  1. The magnitude of v\vec{v} should be equal to the product of magnitudes of v1\vec{v_{1}} and v2\vec{v_{2}}.
  2. Angle formed with the positive xx - axis of v\vec{v} should be equal to the sum of θ1\theta_{1} and θ2\theta_{2}.

Input

The first line will contain an integer TT ( 1T1051\le T \le 10^5 ) denoting the number of test cases. For each test case there will be exactly one line that contains four integers x1,y1,x2,y2x_{1}, y_{1}, x_{2}, y_{2}. The values of x1,y1,x2,y2x_{1}, y_{1}, x_{2}, y_{2} will be in the range [108,+108]\left[-10^8, +10^8\right].

Output

Print xx and yy in a line for each test case. It is guaranteed that xx and yy will be integers.

Sample

InputOutput
2
2 0 0 5
1 1 -1 -1
0 10
0 -2

Submit

Login to submit.

Statistics

42% Solution Ratio
NirjhorEarliest, Aug '20
royantar0311Fastest, 0.1s
shariful_islamLightest, 3.5 MB
bokaifShortest, 78B
Toph uses cookies. By continuing you agree to our Cookie Policy.