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

sunuke = [True]*N

for i in range(K):

    d = int(eval(input()))

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

    for a in A:

        sunuke[a-1] = False



ans = 0

for i in range(N):

    if sunuke[i]:

        ans += 1

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

flag = [True]*N

for i in range(K):

    d = int(eval(input()))

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

    for a in A:

        flag[a-1] = False

ans = 0

for i in range(N):

    if flag[i]:

        ans += 1

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

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

-sunuke = [True] * N +flag = [True] * N -        sunuke[a - 1] = False +        flag[a - 1] = False -    if sunuke[i]: +    if flag[i]: