Given two sequences of numbers, each sorted nondecreasingly, compute which number occurs more times in total in both sequences, and how many times it occurs.
Input consists of several cases, each one with two sequences sorted in nondecreasing order. Every sequence starts with its number of items , followed by the elements, all between 0 and . Suppose that every is between 0 and , and that at least one of the two sequences is not empty.
For every case, print which number occurs more times (the largest in the event of a tie), and how many times it occurs.
Input
3 0 4 6 4 2 3 4 5 4 10 20 30 40 3 10 10 30 6 10 10 12 20 20 20 8 6 6 6 10 12 12 25 25 0 1 1000000000 4 42 800000000 800000000 1000000000 0
Output
4 2 10 3 20 3 1000000000 1 800000000 2