n = int(input())
counts = {}
for i in range(n):
    s = input()
    if s not in counts:
        counts[s] = 0
    counts[s] += 1
print(max(counts.values()))

aca2c91d3553c41d15f69eb1e82a1c7e399b2ff5
<mask token>

<mask token>
for i in range(n):
    s = input()
    if s not in counts:
        counts[s] = 0
    counts[s] += 1
print(max(counts.values()))

n = int(input())
counts = {}
for i in range(n):
    s = input()
    if s not in counts:
        counts[s] = 0
    counts[s] += 1
print(max(counts.values()))
