N = int(eval(input()))



a = []

for i in range(N):

    S = str(eval(input()))

    a.append(S)



count = len(list(set(a)))

print(count)
N = int(eval(input()))

a = []

for i in range(N):

  f = eval(input())

  a.append(f)

  

a=list(set(a))



print((len(a)))
N = int(eval(input()))
a = []
for i in range(N):
    S = str(eval(input()))
    a.append(S)
count = len(list(set(a)))
print(count)

N = int(eval(input()))
a = []
for i in range(N):
    f = eval(input())
    a.append(f)
a = list(set(a))
print((len(a)))

-    S = str(eval(input())) -    a.append(S) -count = len(list(set(a))) -print(count) +    f = eval(input()) +    a.append(f) +a = list(set(a)) +print((len(a)))