






"""simple docstring"""





import sys
from collections import defaultdict


class      _lowercase :


      def __init__(    self				:	Any						):





            """simple docstring"""







            __snake_case      :    Any  			=[]


      def _UpperCamelCase						(    self				:	Union[str, Any]							,   a				:	int						):





            """simple docstring"""







            return self.node_position[vertex]


      def _UpperCamelCase						(    self				:	int							,   a				:	Dict							,   a				:	List[Any]						):





            """simple docstring"""







            __snake_case      :    Any  			=pos


      def _UpperCamelCase						(    self				:	Optional[Any]							,   a				:	int							,   a				:	Optional[int]							,   a				:	Tuple							,   a				:	Dict						):





            """simple docstring"""







            if start > size // 2 - 1:
                  return
            else:
                  if 2 * start + 2 >= size:
                        __snake_case      :    List[Any]  			=2 * start + 1
                  else:
                        if heap[2 * start + 1] < heap[2 * start + 2]:
                              __snake_case      :    Tuple  			=2 * start + 1
                        else:
                              __snake_case      :    List[str]  			=2 * start + 2
                  if heap[smallest_child] < heap[start]:
                        __snake_case			,				__snake_case      :    List[Any]  			=heap[smallest_child], positions[smallest_child]
                        __snake_case			,				__snake_case      :    Optional[Any]  			=(
                            heap[start],
                            positions[start],
                        )
                        __snake_case			,				__snake_case      :    Optional[int]  			=temp, tempa

                        __snake_case      :    Any  			=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 _UpperCamelCase						(    self				:	Any							,   a				:	Dict							,   a				:	Optional[int]							,   a				:	Union[str, Any]							,   a				:	str						):





            """simple docstring"""







            __snake_case      :    List[str]  			=position[index]

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

                  if val < heap[parent]:
                        __snake_case      :    List[str]  			=heap[parent]
                        __snake_case      :    Optional[Any]  			=position[parent]
                        self.set_position(position[parent]							,   a						)
                  else:
                        __snake_case      :    Any  			=val
                        __snake_case      :    Optional[int]  			=temp
                        self.set_position(a							,   a						)
                        break
                  __snake_case      :    str  			=parent
            else:
                  __snake_case      :    Any  			=val
                  __snake_case      :    Any  			=temp
                  self.set_position(a							,   0						)


      def _UpperCamelCase						(    self				:	str							,   a				:	Optional[Any]							,   a				:	int						):





            """simple docstring"""







            __snake_case      :    Union[str, Any]  			=len(a						) // 2 - 1
            for i in range(a							,   -1							,   -1						):
                  self.top_to_bottom(a							,   a							,   len(a						)							,   a						)







      def _UpperCamelCase						(    self				:	Optional[Any]							,   a				:	Optional[int]							,   a				:	List[Any]						):





            """simple docstring"""







            __snake_case      :    str  			=positions[0]
            __snake_case      :    Union[str, Any]  			=sys.maxsize
            self.top_to_bottom(a							,   0							,   len(a						)							,   a						)
            return temp



def     __lowercase					(    a :				Optional[Any] )					->					List[str]:
      __snake_case      :    str  			=Heap()

      __snake_case      :    Optional[Any]  			=[0] * len(a )
      __snake_case      :    Any  			=[-1] * len(a )  # Neighboring Tree Vertex of selected vertex
      # Minimum Distance of explored vertex with neighboring vertex of partial tree
      # formed in graph
      __snake_case      :    Optional[Any]  			=[]  # Heap of Distance of vertices from their neighboring vertex
      __snake_case      :    int  			=[]

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

      __snake_case      :    int  			=[]
      __snake_case      :    int  			=1
      __snake_case      :    Union[str, Any]  			=sys.maxsize
      for neighbor, distance in adjacency_list[0]:
            __snake_case      :    List[str]  			=0
            __snake_case      :    str  			=distance
      heap.heapify(a       ,		a )

      for _ in range(1       ,		len(a ) ):
            __snake_case      :    Union[str, Any]  			=heap.delete_minimum(a       ,		a )
            if visited[vertex] == 0:
                  tree_edges.append((nbr_tv[vertex], vertex) )
                  __snake_case      :    Optional[Any]  			=1
                  for neighbor, distance in adjacency_list[vertex]:
                        if (
                            visited[neighbor] == 0
                            and distance < distance_tv[heap.get_position(a )]
                        ):
                              __snake_case      :    List[Any]  			=distance
                              heap.bottom_to_top(
                                  a       ,		heap.get_position(a )       ,		a       ,		a )
                              __snake_case      :    List[Any]  			=vertex
      return tree_edges


if __name__ == "__main__":  # pragma: no cover
    # < --------- Prims Algorithm --------- >
    UpperCamelCase_	:				Tuple										= int(input("""Enter number of edges: """).strip())
    UpperCamelCase_	:				Union[str, Any]										= defaultdict(list)
    for _ in range(edges_number):
        UpperCamelCase_	:				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"""





from __future__ import annotations



def     __lowercase					(    a :				int       ,		a :				int )					->					list[str]:
      if partitions <= 0:
            raise ValueError('''partitions must be a positive number!''' )
      if partitions > number_of_bytes:
            raise ValueError('''partitions can not > number_of_bytes!''' )
      __snake_case      :    List[str]  			=number_of_bytes // partitions
      __snake_case      :    str  			=[]
      for i in range(a ):
            __snake_case      :    Optional[Any]  			=i * bytes_per_partition + 1
            __snake_case      :    Any  			=(
                number_of_bytes if i == partitions - 1 else (i + 1) * bytes_per_partition
            )
            allocation_list.append(f'''{start_bytes}-{end_bytes}''' )
      return allocation_list


if __name__ == "__main__":
    import doctest

    doctest.testmod()


