#K90732. Marathon Contest Winners
Marathon Contest Winners
Marathon Contest Winners
You are given the results of several coding marathon rounds. Each round (or test case) involves several participants along with the list of problems they have solved. Your task is to determine, for each test case, who solved the maximum number of problems. If there are multiple such participants, output their names in ascending lexicographical order.
The input begins with an integer \(T\) representing the number of test cases. For each test case, the first line contains an integer \(N\) which is the number of participants. The following \(N\) lines each contain a participant's name followed by the identifiers of the problems they solved. A participant who solved no problems will have only their name on the line.
For each test case, print a single line containing the winners' names separated by a space.
inputFormat
The input is read from standard input (stdin) and has the following format:
T N1 participant1 data participant2 data ... (N1 lines) N2 participant1 data participant2 data ... (N2 lines) ...
Where:
- T: Number of test cases.
- For each test case, the first line is an integer N representing the number of participants.
- Each of the next N lines contains space-separated values, starting with a participant's name followed by the identifiers of the problems they solved (if any). </p>
outputFormat
For each test case, output a single line to standard output (stdout) that contains the names of the participant(s) with the highest number of problems solved, sorted in ascending lexicographical order and separated by a space.
## sample2
3
Alice a1 a2 a3
Bob a1 a2
Charlie a1 a2 a3
2
Daniel b1 b2 b3
Mike b1 b2
Alice Charlie
Daniel
</p>