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

s = set([i for i in range(1, N+1)])

ss =  set()

for i in range(K):

    int(eval(input()))

    ss = ss | set(list(map(int, input().split())))

print((len(s - ss)))   
N, K = list(map(int, input().split()))

s = set([i for i in range(1, N+1)])

ss = []

for i in range(K):

    int(eval(input()))

    ss += list(map(int, input().split()))

print((len(s - set(ss)))) 
N, K = list(map(int, input().split()))
s = set([i for i in range(1, N + 1)])
ss = set()
for i in range(K):
    int(eval(input()))
    ss = ss | set(list(map(int, input().split())))
print((len(s - ss)))

N, K = list(map(int, input().split()))
s = set([i for i in range(1, N + 1)])
ss = []
for i in range(K):
    int(eval(input()))
    ss += list(map(int, input().split()))
print((len(s - set(ss))))

-ss = set() +ss = [] -    ss = ss | set(list(map(int, input().split()))) -print((len(s - ss))) +    ss += list(map(int, input().split())) +print((len(s - set(ss))))