406588: GYM102448 G Gorggeous Peter's Great Friend

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Gorggeous Peter's Great Friendtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Gorggeous Peter was the first employee of the company Inlouco and also from the single team from UFPE that won the Latin American award at ICPC, being a strong influencer in the tradition of the Maratona CIn and a great friend of the UFPE marathonists, sometimes being called the godfather of the marathonists.

One of the reasons he is called the godfather of the marathonists is that he convinced Inlouco to sponsor the Brazilian finals, which included an amazing lecture of his that was so good it made a lot of marathonists apply to Inlouco's internship. Because of that, he had the idea of creating an initial phase of the hiring process to filter out the candidates.

For this phase, he selected some problems from the website ForceCodes, assigning $$$Score_j$$$ to the $$$j$$$-th problem. After eating açai with his great friend, Gabriel he opened the ForceCodes submissions page and noticed that it had all submissions from all users of the website.

Gorggeous then decided to write a program that would receive this list of submissions and return the score $$$Ans_i$$$ of each candidate, where this score would be the sum of the scores $$$Score_j$$$ of all problems $$$j$$$ he received the verdict $$$AC$$$. However, since Gorggeous noticed this problem was too easy to him and would not be fun to solve, he asked that you, his new great friend, metesse bronca!!

Note: it is guaranteed that after a user receives the verdict $$$AC$$$ in a problem, he will not submit in the same problem again.

Input

The first line of input contains three integers $$$C$$$, $$$P$$$ e $$$S$$$ ($$$0 < C, P, S \le 5 \cdot 10^{4}$$$) respectively the amount of candidates, the amount of problems Gorggeous selected and the number of submissions.

The $$$i$$$-th of the next $$$C$$$ lines contain the string $$$Handle_i$$$ of $$$i$$$-t candidate.

The $$$j$$$-th of the next $$$P$$$ lines contain the string $$$Id_j$$$ and the integer $$$Score_j$$$ ($$$0 < Score_j \le 2 \cdot 10^{4}$$$) of the $$$j$$$-th problem Gorggeous selected.

The $$$k$$$-th of the next $$$S$$$ lines contain three strings $$$User_k$$$, $$$Problem_k$$$ and $$$Verdict_k$$$, which means that the user with handle $$$User_k$$$ submitted in the problem with id $$$Problem_k$$$ and received verdict $$$Verdict_k$$$.

It is guaranteed that all strings from the input contains only letters and numbers and no more than $$$20$$$ characters long.

Output

You should print $$$C$$$ lines, where the $$$i$$$-th of them should contains the string $$$Handle_i$$$ and the integer $$$Ans_i$$$, the score of the $$$i$$$-th candidate.

ExampleInput
2 2 4
GabrielPessoa
beza
metebronca 100
geometry 200
beza metebronca AC
ffern numbertheory AC
GabrielPessoa geometry WA
beza geometry AC
Output
GabrielPessoa 0
beza 300

加入题单

上一题 下一题 算法标签: