#C6678. Employee Sorting

    ID: 50464 Type: Default 1000ms 256MiB

Employee Sorting

Employee Sorting

You are given a list of employees. Each employee has a name and an age. Your task is to sort the employees in ascending order first by their age and then by their name in alphabetical order if their ages are the same. Formally, for each employee, consider the tuple \((\text{age}, \text{name})\); the list should be sorted in increasing order based on these tuples.

Finally, output only the names of the employees in the sorted order.

inputFormat

The input is read from standard input (stdin). The first line contains an integer \(n\) representing the number of employees. Each of the next \(n\) lines contains an employee's name and age separated by a space.

outputFormat

Output the sorted employee names to standard output (stdout), each on a new line.

## sample
4
Alice 30
Bob 25
Eve 25
Charlie 30
Bob

Eve Alice Charlie

</p>