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

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

l = list(set(n))



print((max(0,max([n.count(l[i]) - m.count(l[i]) for i in range(len(l))]))))
n = [eval(input()) for _ in range(int(eval(input())))]

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

l = set(n)

print((max(0,max([n.count(i) - m.count(i) for i in l]))))
n = [eval(input()) for _ in range(int(eval(input())))]
m = [eval(input()) for _ in range(int(eval(input())))]
l = list(set(n))
print((max(0, max([n.count(l[i]) - m.count(l[i]) for i in range(len(l))]))))

n = [eval(input()) for _ in range(int(eval(input())))]
m = [eval(input()) for _ in range(int(eval(input())))]
l = set(n)
print((max(0, max([n.count(i) - m.count(i) for i in l]))))

-l = list(set(n)) -print((max(0, max([n.count(l[i]) - m.count(l[i]) for i in range(len(l))])))) +l = set(n) +print((max(0, max([n.count(i) - m.count(i) for i in l]))))