q=set(map(str,list(range(31))))

for s in open(0).readlines()[1:]:

    t=set(s.split()[1:])

    q&=t

print((len(q)))
a,b=list(map(int,input().split()))

for i in range(a):

    n,*a=list(map(int,input().split()))

    if i==0:

        l=a

    else:

        l=set(a)&set(l)

print((len(l)))
q = set(map(str, list(range(31))))
for s in open(0).readlines()[1:]:
    t = set(s.split()[1:])
    q &= t
print((len(q)))

a, b = list(map(int, input().split()))
for i in range(a):
    n, *a = list(map(int, input().split()))
    if i == 0:
        l = a
    else:
        l = set(a) & set(l)
print((len(l)))

-q = set(map(str, list(range(31)))) -for s in open(0).readlines()[1:]: -    t = set(s.split()[1:]) -    q &= t -print((len(q))) +a, b = list(map(int, input().split())) +for i in range(a): +    n, *a = list(map(int, input().split())) +    if i == 0: +        l = a +    else: +        l = set(a) & set(l) +print((len(l)))