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

count = [0]*n

for i in range(k):

    d = int(eval(input()))

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

    for j in range(len(a)):

        count[a[j]-1] += 1



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

ans = [0]*n

for i in range(k):

    d = int(eval(input()))

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

    for j in range(len(a)):

        ans[a[j]-1] += 1

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

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

-count = [0] * n +ans = [0] * n -        count[a[j] - 1] += 1 -print((count.count(0))) +        ans[a[j] - 1] += 1 +print((ans.count(0)))