a= set()

n = int(eval(input()))

for i in range(n):

    a.add(int(eval(input())))

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

dat = {}

for _ in range(n):

    dat[int(eval(input()))] = True

print((len(list(dat.items()))))
a = set()
n = int(eval(input()))
for i in range(n):
    a.add(int(eval(input())))
print((len(a)))

n = int(eval(input()))
dat = {}
for _ in range(n):
    dat[int(eval(input()))] = True
print((len(list(dat.items()))))

-a = set() -for i in range(n): -    a.add(int(eval(input()))) -print((len(a))) +dat = {} +for _ in range(n): +    dat[int(eval(input()))] = True +print((len(list(dat.items()))))