#coding : utf-8



n = int(eval(input()))

d = []

for i in range(n):

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

d_uniq = list(set(d))

print((len(d_uniq)))
N = int(eval(input()))

d = {}



for _ in range(N):

    i = int(eval(input()))

    if i in list(d.keys()):

        d[i] += 1

    else:

        d[i] = 1



print((len(d)))
# coding : utf-8
n = int(eval(input()))
d = []
for i in range(n):
    d.append(int(eval(input())))
d_uniq = list(set(d))
print((len(d_uniq)))

N = int(eval(input()))
d = {}
for _ in range(N):
    i = int(eval(input()))
    if i in list(d.keys()):
        d[i] += 1
    else:
        d[i] = 1
print((len(d)))

-# coding : utf-8 -n = int(eval(input())) -d = [] -for i in range(n): -    d.append(int(eval(input()))) -d_uniq = list(set(d)) -print((len(d_uniq))) +N = int(eval(input())) +d = {} +for _ in range(N): +    i = int(eval(input())) +    if i in list(d.keys()): +        d[i] += 1 +    else: +        d[i] = 1 +print((len(d)))