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

a = [list(map(int, input().split())) for i in range(2*k)]

ans = [0]*n

for i in range(k):

    for j in range(a[i*2][0]):

        s = a[i*2+1][j]

        ans[s-1] = 1

S = n - sum(ans)

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

a = [list(map(int, input().split())) for i in range(2*k)]

ans = [0]*n

for i in range(k):

    for j in range(a[i*2][0]):

        s = a[i*2+1][j]

        ans[s-1] += 1

ans = [str(i) for i in ans]

print((ans.count('0')))
n, k = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(2 * k)]
ans = [0] * n
for i in range(k):
    for j in range(a[i * 2][0]):
        s = a[i * 2 + 1][j]
        ans[s - 1] = 1
S = n - sum(ans)
print(S)

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

-        ans[s - 1] = 1 -S = n - sum(ans) -print(S) +        ans[s - 1] += 1 +ans = [str(i) for i in ans] +print((ans.count("0")))