Competitive Arcade Basketball

/problems/competitivearcadebasketball/file/statement/en/img-0001.jpg
Source: pixabay

You’re attending a arcade basketball competition, where the objective is to score as many points as possible until the time runs out. The announcer has informed the crowd that their scoreboard is broken, so they don’t have a way to keep track of all the scores. As a seasoned programmer, you feel you can whip up a program that can keep track of the names of the players and the amount of points they’ve scored, announcing the winner(s) at the end of the contest.

Input

The first line contains three integers: the number of participants $n$ ($1 \le n \le 100\, 000$); the minimum number $p$ of points required to win the contest ($1 \le p \le 10\, 001$); and $m$, the number of lines with player names and points ($1 \le m \le 200\, 000$). The next $n$ lines contain the names of the participants, each mentioned exactly once. Each name consist of no more than $20$ alphanumerical characters. The remaining $m$ lines each contain the name of a participant, followed by how many points they scored ($1$, $2$, or $3$).

Output

Output the names of those participants who reached the minimum required score, one per line! Output “<Winner> wins!” for each winner. Output the winners in the order in which they’ve reached the required score. If no one reaches the minimum required score, output “No winner!” (including the exclamation mark!).

Sample Input 1 Sample Output 1
3 10 13
John
Kelly
George
Kelly 1
George 2
Kelly 1
John 2
George 1
John 3
Kelly 3
Kelly 1
George 3
George 1
John 3
George 3
Kelly 1
George wins!
Sample Input 2 Sample Output 2
4 10 13
Bob
Nina
Jess
Tim
Nina 2
Bob 2
Nina 1
Jess 3
Bob 2
Jess 2
Nina 1
Jess 2
Nina 3
Bob 1
Nina 3
Jess 3
Bob 2
Nina wins!
Jess wins!
Sample Input 3 Sample Output 3
4 15 13
Bob
Nina
Jess
Tim
Nina 2
Bob 2
Nina 1
Jess 3
Bob 2
Jess 2
Nina 1
Jess 2
Nina 3
Bob 1
Nina 3
Jess 3
Bob 2
No winner!