'''simple docstring'''




import sys
from collections import defaultdict




class        a__ :






     def __init__(					self						:						Optional[Any]       ):





         """simple docstring"""



         __lowerCamelCase            =    []






     def   SCREAMING_SNAKE_CASE__  (					self						:						List[Any]    ,							a						:						List[str]       ):





         """simple docstring"""



         return self.node_position[vertex]






     def   SCREAMING_SNAKE_CASE__  (					self						:						int    ,							a						:						Dict    ,							a						:						Any       ):





         """simple docstring"""



         __lowerCamelCase            =    pos






     def   SCREAMING_SNAKE_CASE__  (					self						:						Union[str, Any]    ,							a						:						Tuple    ,							a						:						str    ,							a						:						Dict    ,							a						:						Tuple       ):





         """simple docstring"""



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

                 __lowerCamelCase            =    self.get_position(positions[smallest_child]       )
                 self.set_position(
                     positions[smallest_child]    ,							self.get_position(positions[start]       )       )
                 self.set_position(positions[start]    ,							a       )

                 self.top_to_bottom(a    ,							a    ,							a    ,							a       )






     def   SCREAMING_SNAKE_CASE__  (					self						:						Tuple    ,							a						:						Union[str, Any]    ,							a						:						Any    ,							a						:						str    ,							a						:						Tuple       ):





         """simple docstring"""



         __lowerCamelCase            =    position[index]

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

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






     def   SCREAMING_SNAKE_CASE__  (					self						:						str    ,							a						:						List[Any]    ,							a						:						Union[str, Any]       ):





         """simple docstring"""



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






     def   SCREAMING_SNAKE_CASE__  (					self						:						Dict    ,							a						:						List[str]    ,							a						:						Union[str, Any]       ):





         """simple docstring"""



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






def __lowerCAmelCase					(				UpperCamelCase__							)      ->       Optional[int]:
    __lowerCamelCase            =    Heap()

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

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

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

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


if __name__ == "__main__":  # pragma: no cover
  # < --------- Prims Algorithm --------- >
  __UpperCAmelCase					=int(input("Enter number of edges: ").strip())
  __UpperCAmelCase					=defaultdict(list)
  for _ in range(edges_number):
    __UpperCAmelCase					=[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 numpy as np






def __lowerCAmelCase					(				UpperCamelCase__							,    UpperCamelCase__							,    UpperCamelCase__							,    UpperCamelCase__							,    UpperCamelCase__							)      ->       str:
    __lowerCamelCase            =    int(np.ceil((x_end - xa) / h							)							)
    __lowerCamelCase            =    np.zeros((n + 1,)							)
    __lowerCamelCase            =    ya
    __lowerCamelCase            =    xa

    for k in range(UpperCamelCase__							):
        __lowerCamelCase            =    f(UpperCamelCase__							,    y[k]							)
        __lowerCamelCase            =    f(x + 0.5 * h							,    y[k] + 0.5 * h * ka							)
        __lowerCamelCase            =    f(x + 0.5 * h							,    y[k] + 0.5 * h * ka							)
        __lowerCamelCase            =    f(x + h							,    y[k] + h * ka							)
        __lowerCamelCase            =    y[k] + (1 / 6) * h * (ka + 2 * ka + 2 * ka + ka)
        x += h

    return y


if __name__ == "__main__":
  import doctest

  doctest.testmod()
