#C528. Sort Books by ISBN

    ID: 48911 Type: Default 1000ms 256MiB

Sort Books by ISBN

Sort Books by ISBN

You are given a list of n books. Each book is described by an ISBN and a title. The ISBNs are strings which may include leading zeros or have different lengths. Your task is to sort the books in lexicographical order according to their ISBN. After sorting, print the titles of the books in order.

Note: If two books have the same ISBN, maintain the original order as they appear in the input.

The ISBNs are compared as strings. For example, given ISBNs "1" and "12345678901234", "1" comes first because it is lexicographically smaller.

The sorting criterion can be represented mathematically as follows:

$$\text{Sort}(\{(ISBN_i, title_i)\}_{i=1}^n) \text{ such that } ISBN_i \leq ISBN_j \text{ for } i < j. $$

inputFormat

The first line contains an integer \(n\) (\(1 \leq n \leq 10^5\)), representing the number of books. The following \(n\) lines each contain an ISBN and a title separated by a space. The ISBN does not contain spaces, whereas the title may contain spaces.

Input is read from standard input (stdin).

outputFormat

Output the sorted list of book titles, one title per line, according to the lexicographical order of their ISBNs. The output is written to standard output (stdout).

## sample
5
1234567890123 The Art of Computer Programming
0000000000001 Artificial Intelligence: A Modern Approach
9876543210123 Introduction to Algorithms
0000000000007 Clean Code
1111111111111 Data Structures and Algorithms
Artificial Intelligence: A Modern Approach

Clean Code Data Structures and Algorithms The Art of Computer Programming Introduction to Algorithms

</p>