from collections import Counter
import numpy as np

a = int(input())
a_list = []
b_list = []

for i in range(a):
  a_list.append(input())
a_list.append('null')

b = int(input())

for i in range(b):
  b_list.append(input())
a_count = Counter(a_list)
b_count = Counter(b_list)
a_list_no_overlap = set(a_list)
print(a_count)

point = []
for i in a_list_no_overlap:
    point.append(a_count[i]-b_count[i])

point_max = np.argmax(point)
print(point_max)
