n = int(eval(input()))

sl = list(eval(input()) for _ in range(n))

m = int(eval(input()))

tl = list(eval(input()) for _ in range(m))



sl_s = list(set(sl))

tl_s = list(set(tl))



ans = 0

for s in sl_s:

    ans = max(ans, sl.count(s) - tl.count(s))



print(ans)
n = int(eval(input()))

sl = list(eval(input()) for _ in range(n))

m = int(eval(input()))

tl = list(eval(input()) for _ in range(m))



cnt = 0

for s in sl:

    cnt = max(cnt, sl.count(s) - tl.count(s))



print(cnt)



n = int(eval(input()))
sl = list(eval(input()) for _ in range(n))
m = int(eval(input()))
tl = list(eval(input()) for _ in range(m))
sl_s = list(set(sl))
tl_s = list(set(tl))
ans = 0
for s in sl_s:
    ans = max(ans, sl.count(s) - tl.count(s))
print(ans)

n = int(eval(input()))
sl = list(eval(input()) for _ in range(n))
m = int(eval(input()))
tl = list(eval(input()) for _ in range(m))
cnt = 0
for s in sl:
    cnt = max(cnt, sl.count(s) - tl.count(s))
print(cnt)

-sl_s = list(set(sl)) -tl_s = list(set(tl)) -ans = 0 -for s in sl_s: -    ans = max(ans, sl.count(s) - tl.count(s)) -print(ans) +cnt = 0 +for s in sl: +    cnt = max(cnt, sl.count(s) - tl.count(s)) +print(cnt)