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.
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.
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$.
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.