|
|||
VoteBenin is organizing a presidential election on March 6, 2016. Several candidates submitted their applications for this presidential election. CENA (“Commission Électorale Nationale Autonome”) is responsible for managing the election. According to Article 15 of the Beninese electoral code, CENA is responsible for the preparation, organization, and supervision of voting and for accumulating the results. As a great programmer, you are asked to help CENA to accumulate the results of the presidential election. Input SpecificationThe first line of the input contains a single integer P (1 ≤ P ≤ 1000), which is the number of data sets that follow. Each data set begins with a line containing the number n of the candidates (1 ≤ n ≤ 100), a space, and the number m of results to accumulate (1 ≤ m ≤ 1000). This line is followed by n lines, containing the names of the candidates, one per line. Each of the next m lines contains a name X of a candidate, the result (number of votes) R of the candidate, and the place C of the vote, separated by single spaces. X and C are strings containing at most 1000 characters and no spaces. R is a positive integer. Output Specification
For each data set, if there is only one winner, generate one line of output with the text
“ Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |