output_description: If N is **good** , print `Yes`; otherwise, print `No`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: # -*- coding: utf-8 -*-
  
  import itertools
  
  
  def shortest_path(st, end, n, w, es):
      # s→iの最短距離
      # st:始点, end:終点, n:頂点数, w:辺の数, es[i]: [辺の始点,辺の終点,辺のコスト]
      d = [float("inf")] * n
      # d[i] : s→iの最短距離
      d[st] = 0
      while True:
          updata = False
          for i in range(w):
              e = es[i]
              # e: 辺iについて [from,to,cost]
              if d[e[0]] != float("inf") and d[e[1]] > d[e[0]] + e[2]:
                  d[e[1]] = d[e[0]] + e[2]
                  updata = True
          if not updata:
              break
          if e[1] == end:
              break
      return d[end]
  
  
  ############入力始まり################
  
  (
      input_load_info_num,
      input_crossing_info_num,
      input_parking_info_num,
      input_delivery_info_num,
      input_query_info_num,
  ) = map(int, input().split())
  # 道路情報数:input_load_info_num
  # 交差点情報数:input_crossing_info_num
  # 駐車可能箇所情報数:input_parking_info_num
  # 配達先情報数:input_delivery_info_num
  # クエリ件数:input_query_info_num
  
  input_load_info = [[] for i in range(input_load_info_num)]
  input_crossing_info = [[] for i in range(input_crossing_info_num)]
  input_parking_info = [[] for i in range(input_parking_info_num)]
  input_delivery_info = [[] for i in range(input_delivery_info_num)]
  input_query_info = [[] for i in range(input_query_info_num)]
  # 入力・道路情報:input_load_info
  # 入力・交差点情報:input_crossing_info
  # 入力・駐車可能箇所情報:input_parking_info
  # 入力・配達先情報:input_delivery_info
  # 入力・クエリ:input_query_info
  
  for i in range(input_load_info_num):
      x, y, z = input().split()
      input_load_info[i] = [x, y, z]
  
  for i in range(input_crossing_info_num):
      x, y, z = input().split()
      input_crossing_info[i] = [x, y, z]
  
  for i in range(input_parking_info_num):
      x, y, z = input().split()
      input_parking_info[i] = [x, y, z]
  
  for i in range(input_delivery_info_num):
      x, y, z = input().split()
      input_delivery_info[i] = [x, y, z]
  
  for i in range(input_query_info_num):
      x, y, z = input().split()
      input_query_info[i] = [x, y, z]
  
  ############入力終わり################
  
  ###########車両での走行グラフ：始まり#####################
  
  node = 0
  
  car_node = []
  # [名前,ノード]
  # [R00SE-S,node]->R00のSE方向時のS
  
  car_graph = []
  # [開始ノード, 終了ノード, 距離]
  
  car_load_info = []
  # [道(SE or ES),距離,開始ノード,終了ノード]
  
  for i in range(input_load_info_num):
      car_load_info.append(
          [input_load_info[i][0] + "SE", int(input_load_info[i][1]), node, node + 1]
      )
      car_node.append([input_load_info[i][0] + "SE-S", node])
      car_node.append([input_load_info[i][0] + "SE-E", node + 1])
      node += 2
  
      if int(input_load_info[i][2]) == 0:
          car_load_info.append(
              [input_load_info[i][0] + "ES", int(input_load_info[i][1]), node, node + 1]
          )
          car_node.append([input_load_info[i][0] + "ES-E", node])
          car_node.append([input_load_info[i][0] + "ES-S", node + 1])
          node += 2
  
  
  for i in range(len(car_load_info)):
      making_point_info = []
      # [Sからの距離,ポイント名,ノード番号]
  
      load = car_load_info[i][0]
  
      if "SE" in load:
          making_point_info.append([0, car_load_info[i][0] + "-S", car_load_info[i][2]])
          # 道路のS地点
  
          for j in range(input_parking_info_num):
              if (
                  load == input_parking_info[j][1] + "SE"
                  and "SE" in input_parking_info[j][0]
              ):
                  making_point_info.append(
                      [int(input_parking_info[j][2]), input_parking_info[j][0], node]
                  )
                  car_node.append([input_parking_info[j][0], node])
                  node += 1
  
          making_point_info.append(
              [car_load_info[i][1], car_load_info[i][0] + "-E", car_load_info[i][3]]
          )
          # 道路のE地点
  
          making_point_info.sort()
          for j in range(len(making_point_info) - 1):
              w = making_point_info[j + 1][0] - making_point_info[j][0]
              car_graph.append([making_point_info[j][2], making_point_info[j + 1][2], w])
  
      if "ES" in load:
          making_point_info.append(
              [car_load_info[i][1], car_load_info[i][0] + "-E", car_load_info[i][2]]
          )
          # 道路のE地点
  
          for j in range(input_parking_info_num):
              if (
                  load == input_parking_info[j][1] + "ES"
                  and "ES" in input_parking_info[j][0]
              ):
                  making_point_info.append(
                      [int(input_parking_info[j][2]), input_parking_info[j][0], node]
                  )
                  car_node.append([input_parking_info[j][0], node])
                  node += 1
  
          making_point_info.append([0, car_load_info[i][0] + "-S", car_load_info[i][3]])
          # 道路のE地点
  
          making_point_info.sort(reverse=True)
          # print(making_point_info)
  
          for j in range(len(making_point_info) - 1):
              w = making_point_info[j][0] - making_point_info[j + 1][0]
              car_graph.append([making_point_info[j][2], making_point_info[j + 1][2], w])
  
  
  for i in range(input_crossing_info_num):
      load1 = input_crossing_info[i][1]  # in
      load2 = input_crossing_info[i][2]  # out
  
      for j in range(len(car_load_info)):
          if load1 == car_load_info[j][0]:
              point1 = car_load_info[j][3]
  
          if load2 == car_load_info[j][0]:
              point2 = car_load_info[j][2]
  
      car_graph.append([point1, point2, 0])
  
  # print(car_load_info)
  # print(car_graph)
  # print(car_node)
  
  ###########車両での走行グラフ：終わり#####################
  
  
  for i in range(input_query_info_num):
      s_point = input_query_info[i][1]
      e_point = input_query_info[i][2]
  
      if int(input_query_info[i][0]) == 0:
          for j in range(len(car_node)):
              if car_node[j][0] == s_point:
                  s_node = car_node[j][1]
              if car_node[j][0] == e_point:
                  e_node = car_node[j][1]
  
          print(shortest_path(s_node, e_node, len(car_node), len(car_graph), car_graph))
  
      if int(input_query_info[i][0]) == 1:
          print("100")
  
problem_description: Statement
  
  We call a 4-digit integer with three or more consecutive same digits, such as
  1118, **good**.
  
  You are given a 4-digit integer N. Answer the question: Is N **good**?
samples: [{"input": "1118", "output": "Yes\n    \n\nN is **good** , since it contains three consecutive 1.\n\n* * *"}, {"input": "7777", "output": "Yes\n    \n\nAn integer is also **good** when all the digits are the same.\n\n* * *"}, {"input": "1234", "output": "No"}]