
'''simple docstring'''

class 		_a     :







   """simple docstring"""




   def __init__(       self    ,__SCREAMING_SNAKE_CASE      ):
    SCREAMING_SNAKE_CASE  :  Any								=		data
    SCREAMING_SNAKE_CASE  :  BinaryTreeNode | None								=		None
    SCREAMING_SNAKE_CASE  :  BinaryTreeNode | None								=		None



def        SCREAMING_SNAKE_CASE_  (	snake_case_				:	BinaryTreeNode | None   ,     snake_case_				:	int							)       ->	BinaryTreeNode | None:
 if node is None:
  SCREAMING_SNAKE_CASE  :  Optional[Any]								=		BinaryTreeNode(snake_case_							)
  return node

 # binary search tree is not empty,
 # so we will insert it into the tree
 # if new_value is less than value of data in node,
 #  add it to left subtree and proceed recursively
 if new_value < node.data:
  SCREAMING_SNAKE_CASE  :  List[Any]								=		insert(node.left_child   ,     snake_case_							)
 else:
  # if new_value is greater than value of data in node,
  #  add it to right subtree and proceed recursively
  SCREAMING_SNAKE_CASE  :  Tuple								=		insert(node.right_child   ,     snake_case_							)
 return node



def        SCREAMING_SNAKE_CASE_  (	snake_case_				:	None | BinaryTreeNode							)       ->	list[int]:  # if node is None,return
 if node:
  SCREAMING_SNAKE_CASE  :  str								=		inorder(node.left_child							)
  SCREAMING_SNAKE_CASE  :  Optional[int]								=		[*inorder_array, node.data]
  SCREAMING_SNAKE_CASE  :  Tuple								=		inorder_array + inorder(node.right_child							)
 else:
  SCREAMING_SNAKE_CASE  :  Any								=		[]
 return inorder_array



def        SCREAMING_SNAKE_CASE_  (	)       ->	BinaryTreeNode | None:
 SCREAMING_SNAKE_CASE  :  List[str]								=		insert(snake_case_   ,     15							)
 insert(snake_case_   ,     10							)
 insert(snake_case_   ,     25							)
 insert(snake_case_   ,     6							)
 insert(snake_case_   ,     14							)
 insert(snake_case_   ,     20							)
 insert(snake_case_   ,     60							)
 return root



def        SCREAMING_SNAKE_CASE_  (	)       ->	None:
 # main function
 SCREAMING_SNAKE_CASE  :  Dict								=		make_tree()
 print('Printing values of binary search tree in Inorder Traversal.'							)
 inorder(snake_case_							)


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   main()




'''simple docstring'''

def        SCREAMING_SNAKE_CASE_  (	snake_case_				:	int   ,     snake_case_				:	list[tuple[int, int, int]]							)       ->	list[tuple[int, int, int]]:
 SCREAMING_SNAKE_CASE  :  List[Any]								=		sorted(snake_case_   ,     key=lambda snake_case_							: edge[2]							)

 SCREAMING_SNAKE_CASE  :  str								=		list(range(snake_case_							)							)

 def find_parent(snake_case_				:	Union[str, Any]							):
  if i != parent[i]:
   SCREAMING_SNAKE_CASE  :  int								=		find_parent(parent[i]							)
  return parent[i]

 SCREAMING_SNAKE_CASE  :  Union[str, Any]								=		0
 SCREAMING_SNAKE_CASE  :  Any								=		[]

 for edge in edges:
  SCREAMING_SNAKE_CASE  :  Dict								=		find_parent(edge[0]							)
  SCREAMING_SNAKE_CASE  :  Optional[int]								=		find_parent(edge[1]							)
  if parent_a != parent_b:
   minimum_spanning_tree_cost += edge[2]
   minimum_spanning_tree.append(snake_case_							)
   SCREAMING_SNAKE_CASE  :  Tuple								=		parent_b

 return minimum_spanning_tree


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

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

   kruskal(num_nodes, edges)


