





def     a						(      _lowercase   :     Any ,						_lowercase   :     str       )     ->list[tuple[int, int, int]]:
  UpperCamelCase__         =	sorted(lowerCamelCase__ ,						key=lambda _lowercase       : edge[2]       )

  UpperCamelCase__         =	list(range(lowerCamelCase__       )       )

  def find_parent(_lowercase   :     List[Any]       ):
    if i != parent[i]:
      UpperCamelCase__         =	find_parent(parent[i]       )
    return parent[i]

  UpperCamelCase__         =	0
  UpperCamelCase__         =	[]

  for edge in edges:
    UpperCamelCase__         =	find_parent(edge[0]       )
    UpperCamelCase__         =	find_parent(edge[1]       )
    if parent_a != parent_b:
      minimum_spanning_tree_cost += edge[2]
      minimum_spanning_tree.append(lowerCamelCase__       )
      UpperCamelCase__         =	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)












__lowerCAmelCase     =			{
    "0": 1,
    "1": 1,
    "2": 2,
    "3": 6,
    "4": 24,
    "5": 120,
    "6": 720,
    "7": 5_040,
    "8": 40_320,
    "9": 362_880,
}

__lowerCAmelCase     =			{145: 145}

__lowerCAmelCase     =			{
    145: 0,
    169: 3,
    36_301: 3,
    1_454: 3,
    871: 2,
    45_361: 2,
    872: 2,
}

def     a						(      _lowercase   :     int       )     ->int:
		if n in CACHE_SUM_DIGIT_FACTORIALS:
				return CACHE_SUM_DIGIT_FACTORIALS[n]
		UpperCamelCase__         =	sum(DIGIT_FACTORIALS[let] for let in str(_lowercase       )       )
		UpperCamelCase__         =	ret
		return ret

def     a						(      _lowercase   :     int ,						_lowercase   :     set | None = None       )     ->int:
		UpperCamelCase__         =	previous or set()
		if n in CHAIN_LENGTH_CACHE:
				return CHAIN_LENGTH_CACHE[n]
		UpperCamelCase__         =	sum_digit_factorials(_lowercase       )
		if next_number in previous:
				UpperCamelCase__         =	0
				return 0
		else:
				previous.add(_lowercase       )
				UpperCamelCase__         =	1 + chain_length(_lowercase ,						_lowercase       )
				UpperCamelCase__         =	ret
				return ret

def     a						(      _lowercase   :     int = 6_0 ,						_lowercase   :     int = 1_0_0_0_0_0_0       )     ->int:
		return sum(1 for i in range(1 ,						_lowercase       ) if chain_length(_lowercase       ) == num_terms       )


if __name__ == "__main__":
				print(f"""{solution() = }""")





