N = int(eval(input()))

A = [0]*N

for i in range(N):

  A[i] = int(eval(input()))

  

ans = len(set(A))

print(ans)
N = int(eval(input()))

D = [int(eval(input())) for _ in range(N)]

print((len(set(D))))
N = int(eval(input()))
A = [0] * N
for i in range(N):
    A[i] = int(eval(input()))
ans = len(set(A))
print(ans)

N = int(eval(input()))
D = [int(eval(input())) for _ in range(N)]
print((len(set(D))))

-A = [0] * N -for i in range(N): -    A[i] = int(eval(input())) -ans = len(set(A)) -print(ans) +D = [int(eval(input())) for _ in range(N)] +print((len(set(D))))