N = int(eval(input()))

S = set(str(eval(input())) for _ in range(N))

print((len(S)))
N = int(eval(input()))

S = set(eval(input()) for i in range(N))

print((len(S)))
N = int(eval(input()))
S = set(str(eval(input())) for _ in range(N))
print((len(S)))

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

-S = set(str(eval(input())) for _ in range(N)) +S = set(eval(input()) for i in range(N))