n=int(eval(input()))

x=set()

for i in range(n):

    x.add(int(eval(input())))

print((len(x)))
n=int(eval(input()))

print((len(set(eval(input()) for i in range(n)))))

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

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

-x = set() -for i in range(n): -    x.add(int(eval(input()))) -print((len(x))) +print((len(set(eval(input()) for i in range(n)))))