blue=int(eval(input()))

b=[]

r=[]

for i in range(blue):

  b.append(eval(input()))

red=int(eval(input()))

for i in range(red):

  r.append(eval(input()))

count=[]

for i in range(len(b)):

  counter=0

  for j in range(len(b)):

    if b[i]==b[j]:

      counter+=1

  for j in range(len(r)):

    if b[i]==r[j]:

      counter-=1

  count.append(counter)

if max(count)<0:

  print((0))

else:

  print((max(count)))
blue=int(eval(input()))

b=[]

r=[]

count=[]

for i in range(blue):

  b.append(eval(input()))

red=int(eval(input()))

for i in range(red):

  r.append(eval(input()))

for i in b:

  count.append(b.count(i)-r.count(i))

if max(count)<0:

  print((0))

else:

  print((max(count)))
blue = int(eval(input()))
b = []
r = []
for i in range(blue):
    b.append(eval(input()))
red = int(eval(input()))
for i in range(red):
    r.append(eval(input()))
count = []
for i in range(len(b)):
    counter = 0
    for j in range(len(b)):
        if b[i] == b[j]:
            counter += 1
    for j in range(len(r)):
        if b[i] == r[j]:
            counter -= 1
    count.append(counter)
if max(count) < 0:
    print((0))
else:
    print((max(count)))

blue = int(eval(input()))
b = []
r = []
count = []
for i in range(blue):
    b.append(eval(input()))
red = int(eval(input()))
for i in range(red):
    r.append(eval(input()))
for i in b:
    count.append(b.count(i) - r.count(i))
if max(count) < 0:
    print((0))
else:
    print((max(count)))

+count = [] -count = [] -for i in range(len(b)): -    counter = 0 -    for j in range(len(b)): -        if b[i] == b[j]: -            counter += 1 -    for j in range(len(r)): -        if b[i] == r[j]: -            counter -= 1 -    count.append(counter) +for i in b: +    count.append(b.count(i) - r.count(i))