#C13475. Sort Books by Edition
Sort Books by Edition
Sort Books by Edition
You are given a list of books. Each book is represented by an edition number and a title. Your task is to sort the list in ascending order by the edition number while preserving the original order of books with equal edition numbers (i.e. stable sort).
Formally, if you have a list of books \(\{(e_i, t_i)\}_{i=1}^N\) where \(e_i\) is the edition number and \(t_i\) is the title, you need to output a new list sorted such that if \(e_a \le e_b\) then book \(a\) appears before book \(b\), and if \(e_a = e_b\), their relative order remains the same as in the input.
The input will be provided via standard input, and the output should be produced on standard output.
inputFormat
The first line contains an integer \(N\), the number of books.
Each of the following \(N\) lines contains a book's details: an integer representing the edition number followed by a string representing the book title. The title may contain spaces and will extend to the end of the line.
outputFormat
Output the sorted list of books, one book per line. For each book, print the edition number and the title separated by a single space.
## sample1
1 BookA
1 BookA
</p>