n = int(eval(input()))

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

S = list(set(S))

print((len(S)))
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)]
S = list(set(S))
print((len(S)))

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

-S = list(set(S)) -print((len(S))) +print((len(set(S))))