Limits 1s, 512 MB

Because all the problems are so hard these days, this is a very simple problem.

Suppose you are given co-ordinates of two points AA and BB in 2D plane, an angle MM and a stick of length LL. One end of the stick is in point BB and it creates MM degree angle with the line ABAB in anti clockwise direction. It means that if one end of the stick is point BB and another end is point CC then angle BB is equal to MM and Length of BCBC is equal to LL. You have to tell the co-ordinates of the other end point of the stick, that is the co-ordinates of point CC.

Input

First line will contains TT (1T10001 \le T \le 1000), the number of test cases. Then for each of case, there will be a line containing 6 integers AxAx, AyAy, BxBx, ByBy (0Ax,Ay,Bx,By100000 \le Ax,Ay,Bx,By \le 10000, AxBxAx \le Bx, AyByAy \le By), MM (0M1800 \le M \le 180) and LL (1L100001 \le L \le 10000).

Output

For each case, print two numbers XX and YY, the co-ordinates of the other end point of the stick rounded to the closest integer number in a line.

Sample

InputOutput
4
0 0 1 1 45 1
0 0 0 5 90 5
1 2 5 2 180 3
923 557 6907 5317 76 8111
1 0
5 5
8 2
10271 -2064

This diagram visualizes the first case in this test.


Submit

Login to submit.

Statistics

79% Solution Ratio
ovis96Earliest, May '18
steinumFastest, 0.0s
steinumLightest, 5.5 kB
NirjhorShortest, 614B
Toph uses cookies. By continuing you agree to our Cookie Policy.