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

a = set()

for i in range(k):

    d = int(eval(input()))

    a |= set(map(int, input().split()))

print((len(set(range(1, n + 1)) - a)))
n, k = list(map(int, input().split()))

a = set()

for i in range(k):

    d = int(eval(input()))

    a |= set(map(int, input().split()))

print((n - len(a)))
n, k = list(map(int, input().split()))
a = set()
for i in range(k):
    d = int(eval(input()))
    a |= set(map(int, input().split()))
print((len(set(range(1, n + 1)) - a)))

n, k = list(map(int, input().split()))
a = set()
for i in range(k):
    d = int(eval(input()))
    a |= set(map(int, input().split()))
print((n - len(a)))

-print((len(set(range(1, n + 1)) - a))) +print((n - len(a)))