#K39557. Sort Seashells

    ID: 26446 Type: Default 1000ms 256MiB

Sort Seashells

Sort Seashells

Given a list of seashells, where each seashell is represented as a pair ( (s, t) ) with an integer size ( s ) and a string type ( t ), your task is to sort the seashells in ascending order based on their sizes. If two seashells have the same size, then sort them by type in alphabetical order.

The input is read from standard input (stdin) and the sorted list is printed to standard output (stdout).

For example, if the input is:
3
3 conch
1 sanddollar
2 starfish

Then the correct output is:
1 sanddollar
2 starfish
3 conch

inputFormat

The first line contains an integer ( n ) representing the number of seashells. Each of the following ( n ) lines contains an integer and a string separated by a space, representing the size and the type of a seashell respectively.

outputFormat

Print exactly ( n ) lines, each containing the size and the type of a seashell in sorted order.## sample

3
3 conch
1 sanddollar
2 starfish
1 sanddollar

2 starfish 3 conch

</p>