Given a list of strings whose suffixes are integers, your task is to sort the strings in ascending order based on the integers at the end of the strings. For example, 'cloud9' would be placed after 'you4', since 4 < 9. If the numbers at the end of two strings are equal, output them in the same order as they are given.
Input Format
The input will contain exactly n+1 lines.The first line contains n, the number of strings.
Lines 2 to n+1 contain the strings to be sorted.
Sample Input
4
bug3
bug1
bug5
bug2
Output Format strings in order
Sample Output
bug1
bug2
bug3
bug5
You must be logged in to submit a solution.