#K86147. Movie Watching Order
Movie Watching Order
Movie Watching Order
You are given m users, each of whom starts watching a movie at a specified start time and continues for a given duration. For the ith user, the movie starts at time si and lasts for di time units.
Your task is to determine the order in which the users finish watching their movies. If two users finish at the same time, the user with the lower user ID (the one who appears earlier in the input) is considered to finish first.
The input is provided via stdin and the output should be printed to stdout as a space-separated list of user IDs in the order they finish.
Note: The finish time for each user is computed as:
\[ finish\ time = s_i + d_i \]inputFormat
The first line of input contains an integer m representing the number of users.
Each of the following m lines contains two space-separated integers: s and d, where s denotes the start time and d is the duration of the movie for that user.
Users are indexed from 1 to m in the order they appear in the input.
outputFormat
Output a single line containing m space-separated integers. These integers represent the user IDs in the order in which they finish watching their movies.
## sample4
2 5
1 3
4 2
5 6
2 3 1 4
</p>