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

a=list(range(1,N+1))

for i in range(K):

  count=int(eval(input()))

  b=input().split(' ')

  for j in range(count):

    if int(b[j]) in a:

      a.remove(int(b[j]))

print((len(a)))
N,K = list(map(int, input().split(' ')))

a=list(range(1,N+1))

for i in range(K):

  count=int(eval(input()))

  b=[int(x.strip()) for x in input().split(' ')]

  for j in range(count):

    if b[j] in a:

      a.remove(b[j])

print((len(a)))
N, K = list(map(int, input().split(" ")))
a = list(range(1, N + 1))
for i in range(K):
    count = int(eval(input()))
    b = input().split(" ")
    for j in range(count):
        if int(b[j]) in a:
            a.remove(int(b[j]))
print((len(a)))

N, K = list(map(int, input().split(" ")))
a = list(range(1, N + 1))
for i in range(K):
    count = int(eval(input()))
    b = [int(x.strip()) for x in input().split(" ")]
    for j in range(count):
        if b[j] in a:
            a.remove(b[j])
print((len(a)))

-    b = input().split(" ") +    b = [int(x.strip()) for x in input().split(" ")] -        if int(b[j]) in a: -            a.remove(int(b[j])) +        if b[j] in a: +            a.remove(b[j])