b = [eval(input()) for i in range(int(eval(input())))]

r = [eval(input()) for i in range(int(eval(input())))]

o = 0

for w in list(set(b)):

  o = max(o, b.count(w) - r.count(w))

  

print(o)
b = [eval(input()) for i in range(int(eval(input())))]

r = [eval(input()) for i in range(int(eval(input())))]

k = 0

for w in list(set(b)):

  k = max(k, b.count(w) - r.count(w))

print(k)
b = [eval(input()) for i in range(int(eval(input())))]
r = [eval(input()) for i in range(int(eval(input())))]
o = 0
for w in list(set(b)):
    o = max(o, b.count(w) - r.count(w))
print(o)

b = [eval(input()) for i in range(int(eval(input())))]
r = [eval(input()) for i in range(int(eval(input())))]
k = 0
for w in list(set(b)):
    k = max(k, b.count(w) - r.count(w))
print(k)

-o = 0 +k = 0 -    o = max(o, b.count(w) - r.count(w)) -print(o) +    k = max(k, b.count(w) - r.count(w)) +print(k)