Each of n people in a queue is described by two integers: a height h and a value k, where k is the number of people standing ahead of this person whose height is greater than or equal to h. The pairs are given in arbitrary order. Reconstruct the queue and output the heights from front to back. The input is guaranteed to come from an actual queue, so a valid reconstruction exists and is unique.
Input format
Line 1: an integer n.
Each of the next n lines: two integers h and k.
Output format
n space-separated integers on one line: the heights from the front of the queue to the back.
Constraints
- 1 ≤ n ≤ 100000
- 1 ≤ h ≤ 1000000000
- 0 ≤ k ≤ n - 1