Problem E
Marble Mayhem
After a long day of setting up marble tracks, you are finally ready to release the marbles! You watch as they zoom down the tracks. After the last marble reaches the end of its track you realize you’ve made a huge mistake. You forgot to record the event! With little time left in the day you decide to wait until tomorrow to run the tracks again. However, the next day you come back to find that all of the tracks have fallen apart! Luckily, as you were building the tracks, you wrote down the length and height of each track.
You also recall that if the angle of inclination of the ramp (i.e., the angle from the horizontal to the ramp) is $\theta $, then the acceleration of an object on the ramp in the vertical direction is $g\cdot \sin (\theta )\sin (\theta )$, and the acceleration in the horizontal direction is $g\cdot \sin (\theta )\cos (\theta )$. Here, $g$ is the downward acceleration due to gravity, approximately $9.81\, m/s^2$. You also remember that the displacement of an object experiencing constant acceleration is given by $d=v_it + \frac{1}{2}at^2$, where $v_i$ is its initial velocity and $a$ is its acceleration.
Given the descriptions of the ramps and assuming friction, air resistance, and rotational inertia are negligible, can you determine the order in which the marbles reached the ends of their tracks?
Input
The first line of the input contains a single integer $n$ ($2\leq n \leq 10^4$) the number of ramps. The next $n$ lines describe the ramps, the $i_{th}$ of which contains two integers $h_i$ ($1 \leq h_i < 1000$) and $l_i$ ($h_i < l_i \leq 1000$) which are the height and length of the $i_{th}$ ramp both in centimeters.
Output
Output $n$ lines each containing a single integer. The $i_{th}$ line should contain the 1-based index of the ramp of the $i_{th}$ marble to finish. It is guaranteed that there will not be a tie. It is further guaranteed that the time it would take for any two marbles to reach the ends of their respective tracks will differ by at least $10^{-9}$ seconds.
| Sample Input 1 | Sample Output 1 |
|---|---|
3 3 5 4 5 1 2 |
3 2 1 |
| Sample Input 2 | Sample Output 2 |
|---|---|
5 55 110 90 100 60 105 50 120 70 100 |
2 5 3 1 4 |
