Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

ACM0302 - VOTE

   Benin is organizing a presidential election the 06th march 2016. Several candidates submitted their applications for this presidential election. The CENA called “Commission Nationale Electorale Autonome” is responsible for managing the election.

   According to Article 15 of the beninese electoral code, the CENA is responsible for the preparation, the organization, the supervision of voting and for the centralization of the results.

   As a great programmer, you are asked to help the CENA to centralize the results of the presidential election.

Input.

   The first line of input contains a single integer P, (1 ≤ P ≤ 1000), which is the number of data sets that follow. Each data set consists of a line containing the number n of the candidates (1 ≤n ≤ 100), a space and the number m of results to centralize (1 ≤ m ≤ 1000) and followed by n lines and m lines. The n lines contain the names of candidates, one per line. The m lines contain each a name X of one candidate, a space, the result R of the candidate and the center C of vote. X and C are strings that will contain at most 1000 characters. R is a positive integer.

Output.

   For each data set, if there is only one winner, generate one line of output with the text “VOTE i: THE WINNER IS ” followed by the name of the winner, followed by space and followed by the total result of the winner. If not, generate the following output: “VOTE i: THERE IS A DILEMMA”. i is the number of the data set.  

Sample test.

N

stdin

stdout

1

2
3 4
Bignon
Akwaba
Sessi
Bignon 1000 Gbegamey
Sessi 1000 Yenawa
Akwaba 5 Vodje
Akwaba 996 Yenawa
2 3
Sena
Sedjro
Sedjro 6003 Malanville
Sena 6000 Kpankpan
Sena 3 Godomey
VOTE 1: THE WINNER IS Akwaba 1001
VOTE 2: THERE IS A DILEMMA

Ավելացրեց.Հրանտ Հովհաննիսյան
Ամսաթիվ.2016-07-22
Ժամանակի սահմանափակումը.1s
Ծրագրի տեքստի սահմանափակումը.50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Լեզուներ.Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE
Աղբյուրը.Beninese Collegiate Programming Contest, 2016

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.