n = int(eval(input()))

d = []

for i in range(n):

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

d = sorted(d)

answer = 1

for i in range(1, n):

	if d[i-1] != d[i]:

		answer += 1

print(answer)
n = int(eval(input()))

d = []

for i in range(n):

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

d.sort()

answer = 1

for i in range(1, n):

	if d[i-1] != d[i]:

		answer += 1

print(answer)
n = int(eval(input()))
d = []
for i in range(n):
    d.append(int(eval(input())))
d = sorted(d)
answer = 1
for i in range(1, n):
    if d[i - 1] != d[i]:
        answer += 1
print(answer)

n = int(eval(input()))
d = []
for i in range(n):
    d.append(int(eval(input())))
d.sort()
answer = 1
for i in range(1, n):
    if d[i - 1] != d[i]:
        answer += 1
print(answer)

-d = sorted(d) +d.sort()