Vasya wants to create a computing system to process arbitrary tasks. As a part of the system he needs an algorithm which will choose an order of task execution.
He came up with the following algorithm:
In order to test the algorithm Vasya wants you to simulate it.
You are given n tasks. For each task, you know the number of seconds li that it takes to complete the task and the moment of time ti when this task is added to the execution queue.
For each task find out the moment of time when it will be completed.
The first line contains an integer number n (1≤n≤105)− the number of task to process. The next n lines contain two integers each: li,ti (1≤li≤105,0≤ti≤105).
Print n space-separated integers. The i-th integer is the moment of time when the i-th task was completed.
1
10 5
15
3
3 0
4 3
5 2
3 7 12
3
3 0
4 2
5 1
3 12 8
6
3 0
5 1
4 2
5 18
4 19
5 14
3 8 12 24 28 19