N,K = list(map(int, input().split()))

a = set()



for i in range(K):

  eval(input())

  b= set(map(int,input().split()))

  a|= b



print((N - len(a)))
N,K = list(map(int, input().split()))

a = set()

for i in range(K):

  gomi = eval(input())

  b = set(map(int,input().split()))

  a |= b

print((N - len(a)))
N, K = list(map(int, input().split()))
a = set()
for i in range(K):
    eval(input())
    b = set(map(int, input().split()))
    a |= b
print((N - len(a)))

N, K = list(map(int, input().split()))
a = set()
for i in range(K):
    gomi = eval(input())
    b = set(map(int, input().split()))
    a |= b
print((N - len(a)))

-    eval(input()) +    gomi = eval(input())