



def       UpperCAmelCase__	(							__snake_case  ,			__snake_case							)				->	list[tuple[int, int, int]]:
  _A          =      sorted(__snake_case  ,			key=lambda __snake_case							: edge[2]							)

  _A          =      list(range(__snake_case							)							)

  def find_parent(__snake_case							):
    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(__snake_case							)
      _A          =      parent_b

  return minimum_spanning_tree


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

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

    kruskal(num_nodes, edges)




from __future__ import annotations




def       UpperCAmelCase__	(							__snake_case  ,			__snake_case  ,			__snake_case  ,			__snake_case							)				->	int:

  # Base Case
  if counter == 0 or capacity == 0:
    return 0

  # If weight of the nth item is more than Knapsack of capacity,
  #   then this item cannot be included in the optimal solution,
  # else return the maximum of two cases:
  #   (1) nth item included
  #   (2) not included
  if weights[counter - 1] > capacity:
    return knapsack(__snake_case  ,			__snake_case  ,			__snake_case  ,			counter - 1							)
  else:
    _A          =      capacity - weights[counter - 1]
    _A          =      values[counter - 1] + knapsack(
        __snake_case  ,			__snake_case  ,			__snake_case  ,			counter - 1							)
    _A          =      knapsack(__snake_case  ,			__snake_case  ,			__snake_case  ,			counter - 1							)
    return max(__snake_case  ,			__snake_case							)


if __name__ == "__main__":
    import doctest

    doctest.testmod()