In car races, a tall pole always stands next to the finish line of the track.
Before the race starts, the pole displays the starting grid: the number of the car in first place on the grid is shown at the top of the pole, the number of the car in second place is shown just below it, and so on.
During the race, the pole displays the current standings: the car currently leading the race is shown at the top, the car in second place just below it, and so on.
Besides each car's current position, the pole also shows, next to each car number, an integer telling how many positions the car has gained or lost compared to the starting grid.
We are in the middle of the Swedish Grand Prix, the final race of the World Championship. The race director, Dr. Shoo Makra, is worried: there have been complaints that the software controlling the pole is defective and may be showing information that does not match the real order of the race.
To check the pole, Dr. Shoo Makra wants to reconstruct the starting grid from the information currently shown on the pole. If a valid starting grid can be reconstructed, he will compare it against the real starting grid. If no valid starting grid can be reconstructed, the pole software is definitely defective.
The pole lists the cars from top to bottom, so the $i$-th car listed is currently in position $i$. Given this list, reconstruct the starting grid, or report that it is impossible.
Can you help Dr. Shoo Makra?
The input contains several test cases.
The first line of each test case contains one integer $N$, the number of cars in the race ($2 \le N \le 10^3$).
Each of the next $N$ lines contains two integers $C$ and $P$ separated by a single space: a car number $C$ ($1 \le C \le 10^4$) and the number of positions $P$ that car has gained (positive) or lost (negative) relative to the starting grid ($-10^6 \le P \le 10^6$), as shown on the pole. The lines are given in pole order, so the $i$-th of these lines describes the car currently in position $i$. All cars in a race have distinct numbers.
The end of the input is indicated by a line containing a single zero.
For each test case, print a single line with the reconstructed starting grid: the car numbers in starting-grid order (position 1 first), separated by single spaces.
If it is impossible to reconstruct a valid starting grid, print a single line containing only $-1$.