#K75662. Alphabetical Word Sorting

    ID: 34470 Type: Default 1000ms 256MiB

Alphabetical Word Sorting

Alphabetical Word Sorting

Given a list of words, decode the hidden message by sorting the words alphabetically according to their first letter. If multiple words share the same starting letter, maintain their original relative order.

The task is to output the sorted words joined by a single space. This problem tests your ability to perform custom sorting and to handle input/output via standard channels.

Note: If two words begin with the same character, preserve the order in which they appeared in the input.

inputFormat

The input is provided via standard input (stdin). The first line contains an integer N representing the number of words. The second line contains N words separated by spaces.

outputFormat

Output the decoded message as a single line. The message is the list of words sorted alphabetically by their first letter (with original order preserved for words with the same first letter), separated by a single space, printed to standard output (stdout).

## sample
10
Amazing Beast Cyclops Shadowcat Magneto Nightcrawler Phoenix Wolverine Storm Gambit
Amazing Beast Cyclops Gambit Magneto Nightcrawler Phoenix Shadowcat Storm Wolverine