#K44707. Sorting Programmers' Achievements

    ID: 27591 Type: Default 1000ms 256MiB

Sorting Programmers' Achievements

Sorting Programmers' Achievements

You are given information about programmers and their achievements. The first line of the input contains an integer \(P\) representing the number of programmers. Each of the next \(P\) lines contains the programmer's name, an integer \(A\) (the number of achievements), followed by \(A\) achievement strings. Your task is to sort the programmers in lexicographical order by their names. Also, for each programmer, sort their achievements in lexicographical order.

After processing, print each programmer's name on a new line followed by their sorted achievements on subsequent lines. The input is read from standard input and the output should be printed to standard output.

inputFormat

The input is given via standard input in the following format:

P
name1 A achievement1 achievement2 ...
name2 A achievement1 achievement2 ...
... 

Where:

  • P is an integer representing the number of programmers.
  • Each subsequent line contains a programmer's name, an integer A representing the number of achievements, followed by A achievement strings.

outputFormat

For each programmer (sorted by name), print the following:

name
achievement1
achievement2
...

Each programmer's achievements are printed sorted lexicographically. Output is printed to standard output.

## sample
3
alice 3 hackathon_leader top_coder open_source_contributor
bob 2 ai_researcher robotics_spirit
charlie 1 bug_finder
alice

hackathon_leader open_source_contributor top_coder bob ai_researcher robotics_spirit charlie bug_finder

</p>