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

counts = [0 for i in range(N)]



for i in range(K):

    d = int(eval(input()))

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

    for a in A:

        counts[a-1] += 1

    

print((counts.count(0)))
N, K = list(map(int,input().split()))

counts = [0]*N

for i in range(K):

    d = int(eval(input()))

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

    for a in A:

        counts[a-1] += 1



print((counts.count(0)))
N, K = list(map(int, input().split()))
counts = [0 for i in range(N)]
for i in range(K):
    d = int(eval(input()))
    A = list(map(int, input().split()))
    for a in A:
        counts[a - 1] += 1
print((counts.count(0)))

N, K = list(map(int, input().split()))
counts = [0] * N
for i in range(K):
    d = int(eval(input()))
    A = list(map(int, input().split()))
    for a in A:
        counts[a - 1] += 1
print((counts.count(0)))

-counts = [0 for i in range(N)] +counts = [0] * N