Author: | A. Klenin | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Scientists of Nearsea Institute of Underwater Life obtained a picture of the mysterious aquatic life form. They wanted to determine the creature's species.
To do that, picture copies were distributed among N experts. Each expert made Gi guesses, each guess consisting of the name of the species and the score sij reflecting expert's level of confidence in the guess. For each expert, all guesses name different species.
You program must choose the species which received the highest total score from all experts.
In the first sample below "Ceramaster_arcticus" species received the total score of 14.
Input file contains integer N on the first line, followed by N line blocks — one for each expert.
Each line block contains integer Gi, on the first line, followed by Gi lines — one for each guess.
Each guess line contains an integer sij followed by a string — guess score and species name. Names consist of Latin letters and underscores (ASCII 95). Names are case-sensitive ("a" and "A" are different names).
Output file must contain names of all species with the score equal to the highest total score, one name per line, sorted lexicographically.
1 ≤ N ≤ 100, 1 ≤ Gi ≤ 100, 1 ≤ sij ≤ 100
Species names contain from 1 to 50 characters.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|