N = int(eval(input()))

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

from collections import Counter

Sc = Counter(S).most_common()

print((len(Sc)))

N = int(eval(input()))

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

print((len(set(S))))

N = int(eval(input()))
S = [eval(input()) for i in range(N)]
from collections import Counter

Sc = Counter(S).most_common()
print((len(Sc)))

N = int(eval(input()))
S = [eval(input()) for i in range(N)]
print((len(set(S))))

-from collections import Counter - -Sc = Counter(S).most_common() -print((len(Sc))) +print((len(set(S))))