output_description: Print his Inner Rating.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N R
attempt: import sys
  
  input = sys.stdin.readline
  from collections import deque
  
  N = int(input())
  graph = [deque([]) for _ in range(N)]
  has = []
  stack = []
  for i in range(N):
      u, k, *v = [int(x) for x in input().split()]
      v.sort()
      for j in v:
          graph[u - 1].append(j)
  time = 0
  arrive_time = [-1] * N
  
  
  def dfs(x):
      stack.append(x)  # 探索スタート地点を「探索候補スタック」に積む
      while stack:  # stackが空になるまで
          v = stack.pop()
          has.append(v)  # 探索済みリストに取り出した地点を格納（ここが現在地点）
          for i in graph[v - 1]:
              if i in has:
                  continue
              elif i in stack:
                  continue
              else:
                  stack.append(i)
      print(*has)
  
  
  dfs(1)
  
problem_description: Statement
  
  Takahashi is a member of a programming competition site, _ButCoder_.
  
  Each member of ButCoder is assigned two values: **Inner Rating** and
  **Displayed Rating**.
  
  The Displayed Rating of a member is equal to their Inner Rating if the member
  has participated in 10 or more contests. Otherwise, the Displayed Rating will
  be their Inner Rating minus 100 \times (10 - K) when the member has
  participated in K contests.
  
  Takahashi has participated in N contests, and his Displayed Rating is R. Find
  his Inner Rating.
samples: [{"input": "2 2919", "output": "3719\n    \n\nTakahashi has participated in 2 contests, which is less than 10, so his\nDisplayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\n* * *"}, {"input": "22 3051", "output": "3051"}]