N = int(eval(input()))

d = set()

for i in range(N):

    d.add(int(eval(input())))

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

d = []

for i in range(N):

    d.append(int(eval(input())))

d = set(d)

print((len(d)))
N = int(eval(input()))
d = set()
for i in range(N):
    d.add(int(eval(input())))
print((len(d)))

N = int(eval(input()))
d = []
for i in range(N):
    d.append(int(eval(input())))
d = set(d)
print((len(d)))

-d = set() +d = [] -    d.add(int(eval(input()))) +    d.append(int(eval(input()))) +d = set(d)