r1=[eval(input()) for _ in range(int(eval(input())))];r2=[eval(input()) for _ in range(int(eval(input())))];ans=0

for i in set(r1): ans=max(ans,r1.count(i)-r2.count(i))

print(ans)
r1,r2=[eval(input()) for _ in range(int(eval(input())))],[eval(input()) for _ in range(int(eval(input())))];ans=0

ans=[r1.count(i)-r2.count(i) for i in set(r1)];print((max(0,max(ans))))
r1 = [eval(input()) for _ in range(int(eval(input())))]
r2 = [eval(input()) for _ in range(int(eval(input())))]
ans = 0
for i in set(r1):
    ans = max(ans, r1.count(i) - r2.count(i))
print(ans)

r1, r2 = [eval(input()) for _ in range(int(eval(input())))], [
    eval(input()) for _ in range(int(eval(input())))
]
ans = 0
ans = [r1.count(i) - r2.count(i) for i in set(r1)]
print((max(0, max(ans))))

-r1 = [eval(input()) for _ in range(int(eval(input())))] -r2 = [eval(input()) for _ in range(int(eval(input())))] +r1, r2 = [eval(input()) for _ in range(int(eval(input())))], [ +    eval(input()) for _ in range(int(eval(input()))) +] -for i in set(r1): -    ans = max(ans, r1.count(i) - r2.count(i)) -print(ans) +ans = [r1.count(i) - r2.count(i) for i in set(r1)] +print((max(0, max(ans))))