N = int(eval(input()))

GACHA={}

for n in range(N):

  g=eval(input())

  GACHA[g]=GACHA.get(g,0)

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

GACHA=[eval(input()) for n in range(N)]

print((len(set(GACHA))))

N = int(eval(input()))
GACHA = {}
for n in range(N):
    g = eval(input())
    GACHA[g] = GACHA.get(g, 0)
print((len(GACHA)))

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

-GACHA = {} -for n in range(N): -    g = eval(input()) -    GACHA[g] = GACHA.get(g, 0) -print((len(GACHA))) +GACHA = [eval(input()) for n in range(N)] +print((len(set(GACHA))))