ad = {}

mi = {}



n = int(eval(input()))

for i in range(n):

    s = eval(input())

    n = ad.get(s, 0)

    n += 1

    ad[s] = n



n = int(eval(input()))

for i in range(n):

    s = eval(input())

    n = mi.get(s, 0)

    n += 1

    mi[s] = n



res = 0

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

    val = ad[k]

    val -= mi.get(k, 0)

    res = max(res, val)



print(res)
d = {}

n = int(eval(input()))

for i in range(n):

    s = eval(input())

    c = d.get(s, 0)

    d[s] = c + 1

m = int(eval(input()))

for i in range(m):

    s = eval(input())

    c = d.get(s, 0)

    d[s] = c - 1

co = 0

wo = ""

for k in d:

    if d[k] > co:

        co = d[k]

        wo = k

print((co if co > 0 else "0"))
ad = {}
mi = {}
n = int(eval(input()))
for i in range(n):
    s = eval(input())
    n = ad.get(s, 0)
    n += 1
    ad[s] = n
n = int(eval(input()))
for i in range(n):
    s = eval(input())
    n = mi.get(s, 0)
    n += 1
    mi[s] = n
res = 0
for k in list(ad.keys()):
    val = ad[k]
    val -= mi.get(k, 0)
    res = max(res, val)
print(res)

d = {}
n = int(eval(input()))
for i in range(n):
    s = eval(input())
    c = d.get(s, 0)
    d[s] = c + 1
m = int(eval(input()))
for i in range(m):
    s = eval(input())
    c = d.get(s, 0)
    d[s] = c - 1
co = 0
wo = ""
for k in d:
    if d[k] > co:
        co = d[k]
        wo = k
print((co if co > 0 else "0"))

-ad = {} -mi = {} +d = {} -    n = ad.get(s, 0) -    n += 1 -    ad[s] = n -n = int(eval(input())) -for i in range(n): +    c = d.get(s, 0) +    d[s] = c + 1 +m = int(eval(input())) +for i in range(m): -    n = mi.get(s, 0) -    n += 1 -    mi[s] = n -res = 0 -for k in list(ad.keys()): -    val = ad[k] -    val -= mi.get(k, 0) -    res = max(res, val) -print(res) +    c = d.get(s, 0) +    d[s] = c - 1 +co = 0 +wo = "" +for k in d: +    if d[k] > co: +        co = d[k] +        wo = k +print((co if co > 0 else "0"))