N = int(eval(input()))

d = list(set([int(eval(input())) for n in range(N)]))

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

ans = len(set([int(eval(input())) for n in range(N)]))

print(ans)
N = int(eval(input()))
d = list(set([int(eval(input())) for n in range(N)]))
print((len(d)))

N = int(eval(input()))
ans = len(set([int(eval(input())) for n in range(N)]))
print(ans)

-d = list(set([int(eval(input())) for n in range(N)])) -print((len(d))) +ans = len(set([int(eval(input())) for n in range(N)])) +print(ans)