Conveyor
General Grievous has a more realistic perspective on the quality of droids compared to Emperor Palpatine. He believes that newer droids are superior.
You have N droids on a conveyor belt. To satisfy Grievous, you need to sort these droids in ascending order based on their year of manufacture (which can be negative). The sorting must be stable, meaning that if two droids have the same year of manufacture, they should remain in the same relative order as they were initially.
Input
The first line contains an integer N – the number of droids (2 ≤ N ≤ 10^5). This is followed by N lines, each describing a droid with a string of exactly four characters (the droid's name) and a number representing the year of manufacture, where the absolute value does not exceed 2·10^9.
Output
Print the names of the droids sorted by their year of manufacture. If multiple droids share the same year, they should appear in the order they were originally listed.