



class    _SCREAMING_SNAKE_CASE						:





     def __init__(							self			:				List[str]					)->Dict:
      __SCREAMING_SNAKE_CASE							:     List[str]							=						[0]
      __SCREAMING_SNAKE_CASE							:     List[str]							=						0





     def 						__snake_case     (							self			:				Optional[int]  ,	UpperCamelCase			:				int					)->None:
      __SCREAMING_SNAKE_CASE							:     Dict							=						self.__heap[i]
      while i // 2 > 0:
       if self.__heap[i] > self.__heap[i // 2]:
        __SCREAMING_SNAKE_CASE							:     int							=						self.__heap[i // 2]
        __SCREAMING_SNAKE_CASE							:     Optional[int]							=						temporary
       i //= 2





     def 						__snake_case     (							self			:				Tuple  ,	UpperCamelCase			:				int					)->None:
      self.__heap.append(UpperCamelCase					)
      self.__size += 1
      self.__swap_up(self.__size					)





     def 						__snake_case     (							self			:				str  ,	UpperCamelCase			:				int					)->None:
      while self.__size >= 2 * i:
       if 2 * i + 1 > self.__size:
        __SCREAMING_SNAKE_CASE							:     Optional[Any]							=						2 * i
       else:
        if self.__heap[2 * i] > self.__heap[2 * i + 1]:
         __SCREAMING_SNAKE_CASE							:     Optional[int]							=						2 * i
        else:
         __SCREAMING_SNAKE_CASE							:     Dict							=						2 * i + 1
       __SCREAMING_SNAKE_CASE							:     int							=						self.__heap[i]
       if self.__heap[i] < self.__heap[bigger_child]:
        __SCREAMING_SNAKE_CASE							:     Optional[Any]							=						self.__heap[bigger_child]
        __SCREAMING_SNAKE_CASE							:     int							=						temporary
       __SCREAMING_SNAKE_CASE							:     Dict							=						bigger_child





     def 						__snake_case     (							self			:				List[str]					)->int:
      __SCREAMING_SNAKE_CASE							:     Any							=						self.__heap[1]
      __SCREAMING_SNAKE_CASE							:     List[str]							=						self.__heap[self.__size]
      self.__size -= 1
      self.__heap.pop()
      self.__swap_down(1					)
      return max_value





     @property
     def 						__snake_case     (							self			:				Tuple					)->Tuple:
      return self.__heap[1:]






     def __len__(							self			:				int					)->Any:
      return self.__size


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      # create an instance of BinaryHeap
      _lowerCamelCase         =	BinaryHeap()
      binary_heap.insert(6)
      binary_heap.insert(10)
      binary_heap.insert(15)
      binary_heap.insert(12)
      # pop root(max-values because it is max heap)
      print(binary_heap.pop())  # 15
      print(binary_heap.pop())  # 12
      # get the list and size after operations
      print(binary_heap.get_list)
      print(len(binary_heap))










def 			__SCREAMING_SNAKE_CASE		(		UpperCamelCase		:      int     ,					UpperCamelCase		:      list[tuple[int, int, int]]	)     ->	list[tuple[int, int, int]]:



	"""simple docstring"""






	a_     			=   sorted(UpperCamelCase     ,					key=lambda UpperCamelCase	: edge[2]	)

	a_     			=   list(range(UpperCamelCase	)	)

	def find_parent(UpperCamelCase		:      Any	):
		if i != parent[i]:
			a_     			=   find_parent(parent[i]	)
		return parent[i]

	a_     			=   0
	a_     			=   []

	for edge in edges:
		a_     			=   find_parent(edge[0]	)
		a_     			=   find_parent(edge[1]	)
		if parent_a != parent_b:
			minimum_spanning_tree_cost += edge[2]
			minimum_spanning_tree.append(UpperCamelCase	)
			a_     			=   parent_b

	return minimum_spanning_tree


if __name__ == "__main__":  # pragma: no cover
			_A     ,				_A							     =       list(map(int, input().strip().split()))
			_A							     =       []

			for _ in range(num_edges):
						_A     ,				_A     ,				_A							     =       (int(x) for x in input().strip().split())
						edges.append((nodea, nodea, cost))

			kruskal(num_nodes, edges)