题目描述
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
ChefX showed ChefY his new pizza slice design. The design is a planar figure that can be drawn in the following way:
Draw a point $\mathsf{A}_0$ and two rays from this point such that the angle between them is $\alpha < \pi/2$.
Mark $N$ points $\mathsf{A}_1, \mathsf{A}_2, \mathsf{A}_3, \ldots, \mathsf{A}_N$ on one ray in this order ($\mathsf{A}_1$ is closest to $\mathsf{A}_0$).
Mark $N$ points $\mathsf{B}_1, \mathsf{B}_2, \mathsf{B}_3, \ldots, \mathsf{B}_N$ on the other ray in this order ($\mathsf{B}_1$ is closest to $\mathsf{A}_0$).
For each valid $i$, draw a line segment between points $\mathsf{A}_i$ and $\mathsf{B}_{i+1}$.
For each valid $i$, draw a line segment between points $\mathsf{B}_i$ and $\mathsf{A}_{i+1}$.
Finally, draw a line segment between points $\mathsf{A}_N$ and $\mathsf{B}_N$.
All these $2N-1$ line segments must have equal lengths, which must also be equal to $|\mathsf{A}_0\mathsf{A}_1| = |\mathsf{A}_0\mathsf{B}_1|$.
The result should look roughly like this:
ChefY wants to show ChefX that he does not know his own design very well. He asks ChefX to compute the angle between three of the marked points in this figure. It is clear that there are only four types of angles:
1. $\angle \mathsf{A}_x\mathsf{A}_y\mathsf{B}_z$
2. $\angle \mathsf{A}_x\mathsf{B}_y\mathsf{A}_z$
3. $\angle \mathsf{A}_x\mathsf{B}_y\mathsf{B}_z$
4. $\angle \mathsf{B}_x\mathsf{A}_y\mathsf{B}_z$
Can you help ChefX find the angle ChefY asks for? It can be proved that under the given constraints, each angle can be written as $\pi \cdot m / n$, where $m$ and $n$ are coprime integers; you should find $m$ and $n$.
------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains five space-separated integers $N$, $t$, $x$, $y$ and $z$. Here, $t$ denotes the type of the angle as listed above.
------ Output ------
For each query, print a single line containing two space-separated integers $m$ and $n$.
------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$2 ≤ N ≤ 10^{9}$
$1 ≤ t ≤ 4$
each angle is between three of the points $A_{0}, A_{1}, \ldots, A_{N}, B_{1}, \ldots, B_{N}$
$|x-y| = 1$
$|y-z| = 1$
each angle is non-zero
------ Subtasks ------
Subtask #1 (10 points): $1 ≤ T ≤ 10$
Subtask #2 (90 points): original constraints
----- Sample Input 1 ------
1
175456798 1 151163203 151163204 151163205
----- Sample Output 1 ------
66583464 116971199
----- explanation 1 ------
Example case 1: The type is $1$, so the angle we want is $\mathsf{A}_{151163203}\mathsf{A}_{151163204}\mathsf{B}_{151163205}$. The angle is $(66583464/116971199) \pi \doteq \mathrm{1.7883}$.
输入格式
见题面
输出格式
见题面