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

A = [[] for _ in range(N)]

for k in range(K):

    d = int(eval(input()))

    for a in map(int, input().split()):

        A[a - 1].append(k)

print((sum([1 for a in A if len(a) == 0])))

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

F = [1 for _ in range(N)]

for _ in range(K):

    d = int(eval(input()))

    for a in map(int, input().split()):

        F[a - 1] = 0

print((sum(F)))

N, K = list(map(int, input().split()))
A = [[] for _ in range(N)]
for k in range(K):
    d = int(eval(input()))
    for a in map(int, input().split()):
        A[a - 1].append(k)
print((sum([1 for a in A if len(a) == 0])))

N, K = list(map(int, input().split()))
F = [1 for _ in range(N)]
for _ in range(K):
    d = int(eval(input()))
    for a in map(int, input().split()):
        F[a - 1] = 0
print((sum(F)))

-A = [[] for _ in range(N)] -for k in range(K): +F = [1 for _ in range(N)] +for _ in range(K): -        A[a - 1].append(k) -print((sum([1 for a in A if len(a) == 0]))) +        F[a - 1] = 0 +print((sum(F)))