n=int(eval(input()))

d=[int(eval(input())) for i in range(n)]

print((len(set(d))))
n=int(eval(input()))

d=[eval(input()) for i in range(n)]

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

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

-d = [int(eval(input())) for i in range(n)] +d = [eval(input()) for i in range(n)]