

"""simple docstring"""



import sys
from collections import defaultdict



class 					a						:



    """simple docstring"""



    def __init__(     self: Tuple       ):






         """simple docstring"""


         A__										=  []

    def 				UpperCamelCase	(     self: Dict    ,						UpperCamelCase: Dict       ):






         """simple docstring"""


         return self.node_position[vertex]

    def 				UpperCamelCase	(     self: Optional[Any]    ,						UpperCamelCase: str    ,						UpperCamelCase: List[str]       ):






         """simple docstring"""


         A__										=  pos

    def 				UpperCamelCase	(     self: str    ,						UpperCamelCase: Any    ,						UpperCamelCase: Optional[Any]    ,						UpperCamelCase: Tuple    ,						UpperCamelCase: List[str]       ):






         """simple docstring"""


         if start > size // 2 - 1:
              return
         else:
              if 2 * start + 2 >= size:
                   A__										=  2 * start + 1
              else:
                   if heap[2 * start + 1] < heap[2 * start + 2]:
                        A__										=  2 * start + 1
                   else:
                        A__										=  2 * start + 2
              if heap[smallest_child] < heap[start]:
                   A__			,				A__										=  heap[smallest_child], positions[smallest_child]
                   A__			,				A__										=  (
                       heap[start],
                       positions[start],
                   )
                   A__			,				A__										=  temp, tempa

                   A__										=  self.get_position(positions[smallest_child]       )
                   self.set_position(
                       positions[smallest_child]    ,						self.get_position(positions[start]       )       )
                   self.set_position(positions[start]    ,						UpperCamelCase       )

                   self.top_to_bottom(UpperCamelCase    ,						UpperCamelCase    ,						UpperCamelCase    ,						UpperCamelCase       )

    def 				UpperCamelCase	(     self: Optional[Any]    ,						UpperCamelCase: List[Any]    ,						UpperCamelCase: Optional[Any]    ,						UpperCamelCase: Dict    ,						UpperCamelCase: Dict       ):






         """simple docstring"""


         A__										=  position[index]

         while index != 0:
              A__										=  int((index - 2) / 2       ) if index % 2 == 0 else int((index - 1) / 2       )

              if val < heap[parent]:
                   A__										=  heap[parent]
                   A__										=  position[parent]
                   self.set_position(position[parent]    ,						UpperCamelCase       )
              else:
                   A__										=  val
                   A__										=  temp
                   self.set_position(UpperCamelCase    ,						UpperCamelCase       )
                   break
              A__										=  parent
         else:
              A__										=  val
              A__										=  temp
              self.set_position(UpperCamelCase    ,						0       )

    def 				UpperCamelCase	(     self: Optional[int]    ,						UpperCamelCase: int    ,						UpperCamelCase: List[str]       ):






         """simple docstring"""


         A__										=  len(UpperCamelCase       ) // 2 - 1
         for i in range(UpperCamelCase    ,						-1    ,						-1       ):
              self.top_to_bottom(UpperCamelCase    ,						UpperCamelCase    ,						len(UpperCamelCase       )    ,						UpperCamelCase       )





    def 				UpperCamelCase	(     self: Optional[int]    ,						UpperCamelCase: Optional[Any]    ,						UpperCamelCase: Dict       ):






         """simple docstring"""


         A__										=  positions[0]
         A__										=  sys.maxsize
         self.top_to_bottom(UpperCamelCase    ,						0    ,						len(UpperCamelCase       )    ,						UpperCamelCase       )
         return temp





def  _snake_case     (    UpperCAmelCase_  :					int			):
     A__										=  Heap()

     A__										=  [0] * len(UpperCAmelCase_			)
     A__										=  [-1] * len(UpperCAmelCase_			)  # Neighboring Tree Vertex of selected vertex
     # Minimum Distance of explored vertex with neighboring vertex of partial tree
     # formed in graph
     A__										=  []  # Heap of Distance of vertices from their neighboring vertex
     A__										=  []

     for vertex in range(len(UpperCAmelCase_			)			):
          distance_tv.append(sys.maxsize			)
          positions.append(UpperCAmelCase_			)
          heap.node_position.append(UpperCAmelCase_			)

     A__										=  []
     A__										=  1
     A__										=  sys.maxsize
     for neighbor, distance in adjacency_list[0]:
          A__										=  0
          A__										=  distance
     heap.heapify(UpperCAmelCase_					,   UpperCAmelCase_			)

     for _ in range(1					,   len(UpperCAmelCase_			)			):
          A__										=  heap.delete_minimum(UpperCAmelCase_					,   UpperCAmelCase_			)
          if visited[vertex] == 0:
               tree_edges.append((nbr_tv[vertex], vertex)			)
               A__										=  1
               for neighbor, distance in adjacency_list[vertex]:
                    if (
                        visited[neighbor] == 0
                        and distance < distance_tv[heap.get_position(UpperCAmelCase_			)]
                    ):
                         A__										=  distance
                         heap.bottom_to_top(
                             UpperCAmelCase_					,   heap.get_position(UpperCAmelCase_			)					,   UpperCAmelCase_					,   UpperCAmelCase_			)
                         A__										=  vertex
     return tree_edges


if __name__ == "__main__":  # pragma: no cover
 # < --------- Prims Algorithm --------- >
 SCREAMING_SNAKE_CASE_					:	List[str]							  =						int(input('Enter number of edges: ').strip())
 SCREAMING_SNAKE_CASE_					:	Any							  =						defaultdict(list)
 for _ in range(edges_number):
  SCREAMING_SNAKE_CASE_					:	Tuple							  =						[int(x) for x in input().strip().split()]
  adjacency_list[edge[0]].append([edge[1], edge[2]])
  adjacency_list[edge[1]].append([edge[0], edge[2]])
 print(prisms_algorithm(adjacency_list))








"""simple docstring"""



import math
import sys





def  _snake_case     (    UpperCAmelCase_  :					int			):
     if number != int(UpperCAmelCase_			):
          raise ValueError("""the value of input must be a natural number"""			)
     if number < 0:
          raise ValueError("""the value of input must not be a negative number"""			)
     if number == 0:
          return 1
     A__										=  [-1] * (number + 1)
     A__										=  0
     for i in range(1					,   number + 1			):
          A__										=  sys.maxsize
          A__										=  int(math.sqrt(UpperCAmelCase_			)			)
          for j in range(1					,   root + 1			):
               A__										=  1 + answers[i - (j**2)]
               A__										=  min(UpperCAmelCase_					,   UpperCAmelCase_			)
          A__										=  answer
     return answers[number]


if __name__ == "__main__":
 import doctest

 doctest.testmod()






