n, k =list(map(int, input().split()))

l = [0] * n

for i in range(k):

  d = int(eval(input()))

  lst = list(map(int,input().split()))

  for i in range(d):

    l[lst[i] - 1] += 1

print((l.count(0)))
n, k = list(map(int, input().split()))

l = [0] * n

for i in range(k):

    d = int(eval(input()))

    a = list(map(int, input().split()))

    for j in range(len(a)):

        l[a[j] - 1] = 1

print((l.count(0)))

n, k = list(map(int, input().split()))
l = [0] * n
for i in range(k):
    d = int(eval(input()))
    lst = list(map(int, input().split()))
    for i in range(d):
        l[lst[i] - 1] += 1
print((l.count(0)))

n, k = list(map(int, input().split()))
l = [0] * n
for i in range(k):
    d = int(eval(input()))
    a = list(map(int, input().split()))
    for j in range(len(a)):
        l[a[j] - 1] = 1
print((l.count(0)))

-    lst = list(map(int, input().split())) -    for i in range(d): -        l[lst[i] - 1] += 1 +    a = list(map(int, input().split())) +    for j in range(len(a)): +        l[a[j] - 1] = 1