a = int(eval(input()))

b = {}

for i in range(a):

    b[int(eval(input()))] = 1

print((len(b)))

a = int(eval(input()))

print((len({int(eval(input())): "" for _ in range(a)})))

a = int(eval(input()))
b = {}
for i in range(a):
    b[int(eval(input()))] = 1
print((len(b)))

a = int(eval(input()))
print((len({int(eval(input())): "" for _ in range(a)})))

-b = {} -for i in range(a): -    b[int(eval(input()))] = 1 -print((len(b))) +print((len({int(eval(input())): "" for _ in range(a)})))