Sort by Age

No attempts yetTime limit3sMemory limit256 MB

Problem

The age and the name of every member of an online judge are given in the order they joined. Write a program that sorts the members by increasing age, and puts the member who joined earlier first when two ages are equal.

Input

The first line contains the number of members NN. (1N1000001 \le N \le 100000)

Each of the next NN lines contains one member's age and name, separated by a single space. The age is an integer between 11 and 200200. The name is a string of at most 100100 uppercase and lowercase English letters. The lines are given in the order the members joined.

Output

Print the sorted result on NN lines. Each line holds one member's age and name, separated by a single space. Members of the same age are printed in the order they joined.