





'''simple docstring'''






import sys
from collections import defaultdict




class  UpperCAmelCase     :




      def __init__(			self			: int  )				->      Optional[Any]:
            _lowerCAmelCase							     =							[]




      def 				lowercase__    (			self			: List[str]			,			__snake_case			: Dict  )				->      List[Any]:
            return self.node_position[vertex]




      def 				lowercase__    (			self			: List[Any]			,			__snake_case			: int			,			__snake_case			: Optional[Any]  )				->      List[Any]:
            _lowerCAmelCase							     =							pos




      def 				lowercase__    (			self			: Optional[int]			,			__snake_case			: Tuple			,			__snake_case			: List[Any]			,			__snake_case			: List[Any]			,			__snake_case			: Optional[Any]  )				->      Dict:
            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]			,			__snake_case  )

                        self.top_to_bottom(__snake_case			,			__snake_case			,			__snake_case			,			__snake_case  )




      def 				lowercase__    (			self			: Dict			,			__snake_case			: Optional[int]			,			__snake_case			: Optional[Any]			,			__snake_case			: Tuple			,			__snake_case			: Optional[int]  )				->      Union[str, Any]:
            _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]			,			__snake_case  )
                  else:
                        _lowerCAmelCase							     =							val
                        _lowerCAmelCase							     =							temp
                        self.set_position(__snake_case			,			__snake_case  )
                        break
                  _lowerCAmelCase							     =							parent
            else:
                  _lowerCAmelCase							     =							val
                  _lowerCAmelCase							     =							temp
                  self.set_position(__snake_case			,			0  )




      def 				lowercase__    (			self			: Any			,			__snake_case			: int			,			__snake_case			: List[Any]  )				->      Dict:
            _lowerCAmelCase							     =							len(__snake_case  ) // 2 - 1
            for i in range(__snake_case			,			-1			,			-1  ):
                  self.top_to_bottom(__snake_case			,			__snake_case			,			len(__snake_case  )			,			__snake_case  )




      def 				lowercase__    (			self			: List[Any]			,			__snake_case			: Dict			,			__snake_case			: Tuple  )				->      Optional[Any]:
            _lowerCAmelCase							     =							positions[0]
            _lowerCAmelCase							     =							sys.maxsize
            self.top_to_bottom(__snake_case			,			0			,			len(__snake_case  )			,			__snake_case  )
            return temp




def    UpperCamelCase__      (		lowerCAmelCase  ):





      """simple docstring"""


      _lowerCAmelCase							     =							Heap()

      _lowerCAmelCase							     =							[0] * len(lowerCAmelCase  )
      _lowerCAmelCase							     =							[-1] * len(lowerCAmelCase  )  # 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(lowerCAmelCase  )  ):
            distance_tv.append(sys.maxsize  )
            positions.append(lowerCAmelCase  )
            heap.node_position.append(lowerCAmelCase  )

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

      for _ in range(1							,	len(lowerCAmelCase  )  ):
            _lowerCAmelCase							     =							heap.delete_minimum(lowerCAmelCase							,	lowerCAmelCase  )
            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(lowerCAmelCase  )]
                        ):
                              _lowerCAmelCase							     =							distance
                              heap.bottom_to_top(
                                  lowerCAmelCase							,	heap.get_position(lowerCAmelCase  )							,	lowerCAmelCase							,	lowerCAmelCase  )
                              _lowerCAmelCase							     =							vertex
      return tree_edges


if __name__ == "__main__":  # pragma: no cover
      # < --------- Prims Algorithm --------- >
      A__				:   Tuple      =int(input('''Enter number of edges: ''').strip())
      A__				:   Dict      =defaultdict(list)
      for _ in range(edges_number):
            A__				:   Any      =[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 string
from math import logaa





def 						__snake_case(				_lowerCAmelCase     ,   _lowerCAmelCase		)		-> int:
      snake_case__  :    List[str]    						=      document.translate(
          str.maketrans(""""""     ,   """"""     ,   string.punctuation		)		).replace("""\n"""     ,   """"""		)
      snake_case__  :    List[str]    						=      document_without_punctuation.split(""" """		)  # word tokenization
      return len([word for word in tokenize_document if word.lower() == term.lower()]		)





def 						__snake_case(				_lowerCAmelCase     ,   _lowerCAmelCase		)		-> tuple[int, int]:
      snake_case__  :    Dict    						=      corpus.lower().translate(
          str.maketrans(""""""     ,   """"""     ,   string.punctuation		)		)  # strip all punctuation and replace it with ''
      snake_case__  :    Any    						=      corpus_without_punctuation.split("""\n"""		)
      snake_case__  :    int    						=      term.lower()
      return (len([doc for doc in docs if term in doc]		), len(_lowerCAmelCase		))





def 						__snake_case(				_lowerCAmelCase     ,   _lowerCAmelCase     ,   _lowerCAmelCase=False		)		-> float:
      if smoothing:
            if n == 0:
                  raise ValueError("""log10(0) is undefined."""		)
            return round(1 + logaa(n / (1 + df)		)     ,   3		)

      if df == 0:
            raise ZeroDivisionError("""df must be > 0"""		)
      elif n == 0:
            raise ValueError("""log10(0) is undefined."""		)
      return round(logaa(n / df		)     ,   3		)





def 						__snake_case(				_lowerCAmelCase     ,   _lowerCAmelCase		)		-> float:
      return round(tf * idf     ,   3		)
