n = int(eval(input()))

S = {}

for i in range(n):

    s = str(eval(input()))

    if s not in S:

        S[s] = 1

    else:

        S[s] += 1

m = int(eval(input()))

T = {}

for i in range(m):

    t = str(eval(input()))

    if t not in T:

        T[t] = 1

    else:

        T[t] += 1



ans = 0

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

    if k in T:

        ans = max(ans, v-T[k])

    else:

        ans = max(ans, v)

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 = 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 = {}
for i in range(n):
    s = str(eval(input()))
    if s not in S:
        S[s] = 1
    else:
        S[s] += 1
m = int(eval(input()))
T = {}
for i in range(m):
    t = str(eval(input()))
    if t not in T:
        T[t] = 1
    else:
        T[t] += 1
ans = 0
for k, v in list(S.items()):
    if k in T:
        ans = max(ans, v - T[k])
    else:
        ans = max(ans, v)
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 = 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)

-S = {} -for i in range(n): -    s = str(eval(input())) -    if s not in S: -        S[s] = 1 +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) -        S[s] += 1 -m = int(eval(input())) -T = {} -for i in range(m): -    t = str(eval(input())) -    if t not in T: -        T[t] = 1 -    else: -        T[t] += 1 -ans = 0 -for k, v in list(S.items()): -    if k in T: -        ans = max(ans, v - T[k]) -    else: -        ans = max(ans, v) +        ans = max(ans, max(0, CS[k] - CT[k]))