A = int(eval(input()))

X = [eval(input()) for _ in range(A)]

B = int(eval(input()))

Y = [eval(input()) for _ in range(B)]

t = 0

for x in X:

  if X.count(x)-Y.count(x)>t:

    t = X.count(x)-Y.count(x)

  else:

    pass

print(t)
N = int(eval(input()))

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

S_set = set(S)

M = int(eval(input()))

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

m = 0

for s in S_set:

  m = max(m, S.count(s)-T.count(s))

print(m)
A = int(eval(input()))
X = [eval(input()) for _ in range(A)]
B = int(eval(input()))
Y = [eval(input()) for _ in range(B)]
t = 0
for x in X:
    if X.count(x) - Y.count(x) > t:
        t = X.count(x) - Y.count(x)
    else:
        pass
print(t)

N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
S_set = set(S)
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
m = 0
for s in S_set:
    m = max(m, S.count(s) - T.count(s))
print(m)

-A = int(eval(input())) -X = [eval(input()) for _ in range(A)] -B = int(eval(input())) -Y = [eval(input()) for _ in range(B)] -t = 0 -for x in X: -    if X.count(x) - Y.count(x) > t: -        t = X.count(x) - Y.count(x) -    else: -        pass -print(t) +N = int(eval(input())) +S = [eval(input()) for _ in range(N)] +S_set = set(S) +M = int(eval(input())) +T = [eval(input()) for _ in range(M)] +m = 0 +for s in S_set: +    m = max(m, S.count(s) - T.count(s)) +print(m)