a = int(eval(input()))

b = [int(eval(input())) for i in range(a)]

c = set(b)

print((len(c)))
a = int(eval(input()))

b = set(int(eval(input())) for i in range(a))

print((len(b)))
a = int(eval(input()))
b = [int(eval(input())) for i in range(a)]
c = set(b)
print((len(c)))

a = int(eval(input()))
b = set(int(eval(input())) for i in range(a))
print((len(b)))

-b = [int(eval(input())) for i in range(a)] -c = set(b) -print((len(c))) +b = set(int(eval(input())) for i in range(a)) +print((len(b)))