x = list(map(int, input().split()))
k = [list(map(int, input().split())) for i in range(x[0])]
f = 0
for i in k:
  i.pop(0)
  if f == 0:
    tmp = i
    f = 1
    s = i
  else:
    s = set(tmp) & set(i)
    tmp = s
print(len(s)) x = list(map(int, input().split())) x list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split list(map(int, input().split())) for i in range(x[0]) for i in range(x[0]) i range(x[0]) range x[0] x 0 for i in range(x[0]) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k = [list(map(int, input().split())) for i in range(x[0])] k [list(map(int, input().split())) for i in range(x[0])] f = 0 f 0 for i in k:
  i.pop(0)
  if f == 0:
    tmp = i
    f = 1
    s = i
  else:
    s = set(tmp) & set(i)
    tmp = s i k i.pop(0) i.pop i pop 0 if f == 0:
    tmp = i
    f = 1
    s = i
  else:
    s = set(tmp) & set(i)
    tmp = s f == 0 f 0 tmp = i tmp i f = 1 f 1 s = i s i s = set(tmp) & set(i) s set(tmp) & set(i) set(tmp) set tmp set(i) set i tmp = s tmp s print(len(s)) print len(s) len s x = list(map(int, input().split())) list(map(int, input().split())) x s = i i s tmp = i i tmp k = [list(map(int, input().split())) for i in range(x[0])] [list(map(int, input().split())) for i in range(x[0])] k f = 0 0 f tmp = s s tmp s = set(tmp) & set(i) set(tmp) & set(i) s f = 1 1 f
x = list(map(int, input().split()))
k = [list(map(int, input().split())) for i in range(x[0])]
f = 0
for i in k:
  i.pop(0)
  if f == 0:
    tmp = i
    f = 1
    s = i
  else:
    s = set(tmp) & set(i)
    tmp = s
print(len(s))