n = int(eval(input()))

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



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

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

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

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