n = int(eval(input()))

D = set(int(eval(input())) for _ in range(n))

print((len(D)))
n = int(eval(input()))

print((len(set(eval(input()) for _ in range(n)))))
n = int(eval(input()))
D = set(int(eval(input())) for _ in range(n))
print((len(D)))

n = int(eval(input()))
print((len(set(eval(input()) for _ in range(n)))))

-D = set(int(eval(input())) for _ in range(n)) -print((len(D))) +print((len(set(eval(input()) for _ in range(n)))))