H. Rotated Image
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Typically, canvas appears static, thus we must resize images to fit it. However, this one is different. The canvas must be reshaped (with a set ratio) to fit the static-sized image.

You have a rectangular image with size $$$a \times b$$$ and a canvas of height and width ratio $$$m:n$$$. What would be the smallest canvas size that would fit the image?

Isn't this too simple?

Play a bit more. The image is rotated by $$$\theta$$$ degrees clockwise. Now, determine the smallest canvas size needed to fit the image using that ratio.

A rotated image inside a canvas.

Note: $$$m, n$$$ may NOT be co-prime.

Input

Each test contains multiple test cases. The first line contains the number of test cases T ($$$1\leq T \leq 10^5$$$). The description of the test cases follows.

Each test case consists of a single line containing five integers $$$a, b, m, n$$$, and $$$\theta$$$ ($$$1 \leq a,b,m,n \leq 10^9, 0 \leq \theta \leq 90$$$) — image size $$$a\times b$$$, canvas ratio $$$m:n$$$ and rotation of the image with the horizontal line.

Output

For each test case, output two integers — the minimum size of the canvas X, Y — height and width. Answer must be integer value.

Example
Input
1
6 18 2 3 30
Output
16 24
Note

Dataset is huge, use faster I/O methods.