n = int(eval(input()))

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

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

print((len(set(eval(input()) for i in [0] * int(eval(input()))))))

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