d = {'':0}

for i in (1,-1):

  for _ in range(int(eval(input()))):

    s = eval(input())

    d[s] = d.get(s,0)+i

print((max(d.values())))
d={0:0}

for i in (1,-1):

  for _ in [0]*int(eval(input())):s=eval(input());d[s]=d.get(s,0)+i

print((max(d.values())))
d = {"": 0}
for i in (1, -1):
    for _ in range(int(eval(input()))):
        s = eval(input())
        d[s] = d.get(s, 0) + i
print((max(d.values())))

d = {0: 0}
for i in (1, -1):
    for _ in [0] * int(eval(input())):
        s = eval(input())
        d[s] = d.get(s, 0) + i
print((max(d.values())))

-d = {"": 0} +d = {0: 0} -    for _ in range(int(eval(input()))): +    for _ in [0] * int(eval(input())):