cnt = int(eval(input()))

set1 = set([int(eval(input())) for i in range(cnt)])

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

d = [int(eval(input())) for i in range(N)]

dd = list(set(d))



print((len(dd)))

cnt = int(eval(input()))
set1 = set([int(eval(input())) for i in range(cnt)])
print((len(set1)))

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

-cnt = int(eval(input())) -set1 = set([int(eval(input())) for i in range(cnt)]) -print((len(set1))) +N = int(eval(input())) +d = [int(eval(input())) for i in range(N)] +dd = list(set(d)) +print((len(dd)))