# 50053. The Most Popular Author

## I'm a slow walker, but I never walk backwards.

Given a list of books written by each author, and the number of copies each book sold, write a program to find the most popular author who has the most number of copies of books sold.

First we are given the lists of books these authors write. There are $M$ of these author-book pairs, as in the following format. We assume that all strings do not have space and tab space. We also assume that the titles of the books are all different.

12345Author_A book_name_aAuthor_B book_name_b...


Then we are given the number of copies each book was sold($0\leq selling\lt 500$). There are also $M$ lines, and each of them is the number of copies sold and the title of the book.

12345book_name_p sellingbook_name_q selling...


## Input Format

The first line is a number $M$ ($0\lt M\lt 100$). Then the following M lines are the lists of author-book pairs, and the next following $M$ lines are the lists of book-selling pairs. The string length of each authors and book names is less than $50$.

## Output Format

One line in output is the most popular author and the number of copies of books sold. If some authors have the same selling, output the first lexicographically one.

## Sample Input

4Alice C_programingJack Java_programingBob Python_programing Alice C++_programingPython_programing 5C++_programing 3Java_programing 6C_programing 3


## Sample Output

Alice 6