URI Online Judge | 1975

Pearls

By Gabriel Duarte, UNIFESO BR Brazil

Timelimit: 1

VI is a very eccentric calculus teacher, always that corrects the proofs of the students (Which by the way are very difficult tests), she notes all the pearls that finds when corrects, so that on the day of delivery she can write all on the blackboard, to let the students embarrassed and they never make the same mistakes.

When the proofs are delivered, students try to discover who it was that had more pearls on the blackboard. As each test the number of pearls increases and students have to study a lot because every week happens a new calculus test, they do not have time to check all the proofs and see who appeared more times in the blackboard.

Knowing that you are programmer they asked your help to show who was the student that had more pearls written on the blackboard that day.

Input

The input contains several test cases. The first line of each test case contains three integers P, A e R (1 ≤ P, A, R ≤ 104), indicating respectively the number of pearls, number of students and the number of responses given by each student. Then have P lines with pearls written on the board that will have a maximum of 1000 characters. Then have A students, for each student the first line is your name with up to 100 lowercase or uppercase characters from 'a' to 'z', following the R lines showing their responses. The input ends when P = A = R = 0, and should not be processed.

OBS: Ignore the possibilities of student entries with the same name or repeated pearls.

Output

For each test case, you should print the name of the student who had more appearances in the blackboard, in case of tie your program will show all students with more appearances separated by commas alphabetically.

Input Sample Output Sample

4 3 3
1 + 1 = 3
((x - 2) + (x - 2)) / (x - 2) = 1
4 / 0 = 0
n! = n^2
gabriel
5 + 5 = 10
1 + 1 = 3
4 / 0 = ERRO
alexandre
((x - 2) + (x - 2)) / (x - 2) != 1
1 + 1 = 2
2 + 3 = 5
anne
1 + 1 = 3
4 / 0 = ERRO
2 + 3 = 5
0 0 0

anne, gabriel