n = int(eval(input()))

s = [(eval(input())) for i in range(n)]

m = int(eval(input()))

t = [(eval(input())) for i in range(m)]

print((max([0]+[s.count(s[i])-t.count(s[i]) for i in range(n)])))

n=int(eval(input()))

s=[eval(input()) for i in range(n)]

m=int(eval(input()))

t=[eval(input()) for i in range(m)]

u=set(s)

ans=0

for i in u:

    cnt=s.count(i)-t.count(i)

    ans=max(ans,cnt)

print(ans)

n = int(eval(input()))
s = [(eval(input())) for i in range(n)]
m = int(eval(input()))
t = [(eval(input())) for i in range(m)]
print((max([0] + [s.count(s[i]) - t.count(s[i]) for i in range(n)])))

n = int(eval(input()))
s = [eval(input()) for i in range(n)]
m = int(eval(input()))
t = [eval(input()) for i in range(m)]
u = set(s)
ans = 0
for i in u:
    cnt = s.count(i) - t.count(i)
    ans = max(ans, cnt)
print(ans)

-s = [(eval(input())) for i in range(n)] +s = [eval(input()) for i in range(n)] -t = [(eval(input())) for i in range(m)] -print((max([0] + [s.count(s[i]) - t.count(s[i]) for i in range(n)]))) +t = [eval(input()) for i in range(m)] +u = set(s) +ans = 0 +for i in u: +    cnt = s.count(i) - t.count(i) +    ans = max(ans, cnt) +print(ans)