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

sunuke=[0]*n

for i in range(k):

    d=int(eval(input()))

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

    for j in a:

        sunuke[j-1]+=1

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

snuke=[0]*n

for i in range(k):

    d=int(eval(input()))

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

    for j in a:

        snuke[j-1]+=1

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

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

-sunuke = [0] * n +snuke = [0] * n -        sunuke[j - 1] += 1 -print((sunuke.count(0))) +        snuke[j - 1] += 1 +print((snuke.count(0)))