n = int(eval(input()))

S = [str(eval(input())) for _ in range(n)]

m = int(eval(input()))

T = [str(eval(input())) for _ in range(m)]



from collections import Counter

CS = Counter(S)

CT = Counter(T)



ans = 0

for k in list(CS.keys()):

    if k not in CT:

        ans = max(CS[k], ans)

    else:

        ans = max(ans, max(0, CS[k]-CT[k]))

print(ans)

n = int(eval(input()))

S = [str(eval(input())) for _ in range(n)]

m = int(eval(input()))

T = [str(eval(input())) for _ in range(m)]



from collections import Counter

cs = Counter(S)

ct = Counter(T)



ans = -10**18

for k, v in list(cs.items()):

    if k in ct:

        temp = v - ct[k]

    else:

        temp = v

    ans = max(ans, temp)

print((max(ans, 0)))

n = int(eval(input()))
S = [str(eval(input())) for _ in range(n)]
m = int(eval(input()))
T = [str(eval(input())) for _ in range(m)]
from collections import Counter

CS = Counter(S)
CT = Counter(T)
ans = 0
for k in list(CS.keys()):
    if k not in CT:
        ans = max(CS[k], ans)
    else:
        ans = max(ans, max(0, CS[k] - CT[k]))
print(ans)

n = int(eval(input()))
S = [str(eval(input())) for _ in range(n)]
m = int(eval(input()))
T = [str(eval(input())) for _ in range(m)]
from collections import Counter

cs = Counter(S)
ct = Counter(T)
ans = -(10**18)
for k, v in list(cs.items()):
    if k in ct:
        temp = v - ct[k]
    else:
        temp = v
    ans = max(ans, temp)
print((max(ans, 0)))

-CS = Counter(S) -CT = Counter(T) -ans = 0 -for k in list(CS.keys()): -    if k not in CT: -        ans = max(CS[k], ans) +cs = Counter(S) +ct = Counter(T) +ans = -(10**18) +for k, v in list(cs.items()): +    if k in ct: +        temp = v - ct[k] -        ans = max(ans, max(0, CS[k] - CT[k])) -print(ans) +        temp = v +    ans = max(ans, temp) +print((max(ans, 0)))