


"""simple docstring"""







from hashlib import mda, shaaaa

__lowercase          = (shaaaa, mda)






class 		_A    :







    """simple docstring"""




    def __init__(   self							:       Tuple							,					__UpperCAmelCase							:       int = 8):
      a		:						str 				=     0B0
      a		:						Tuple 				=     size






    def       __snake_case				(   self							:       Union[str, Any]							,					__UpperCAmelCase							:       str):
      a		:						int 				=     self.hash_(__UpperCAmelCase)
      self.bitarray |= h






    def       __snake_case				(   self							:       str							,					__UpperCAmelCase							:       str):
      a		:						Dict 				=     self.hash_(__UpperCAmelCase)
      return (h & self.bitarray) == h






    def __contains__(   self							:       Any							,					__UpperCAmelCase							:       str):
      return self.exists(__UpperCAmelCase)






    def       __snake_case				(   self							:       Dict							,					__UpperCAmelCase							:       int):
      a		:						str 				=     bin(__UpperCAmelCase)[2:]
      return res.zfill(self.size)






    @property
    def       __snake_case				(   self							:       int):
      return self.format_bin(self.bitarray)






    def       __snake_case				(   self							:       List[Any]							,					__UpperCAmelCase							:       str):
      a		:						Union[str, Any] 				=     0B0
      for func in HASH_FUNCTIONS:
        a		:						Any 				=     (
            int.from_bytes(func(value.encode()).digest()							,					"little") % self.size
        )
        res |= 2**position
      return res






    def       __snake_case				(   self							:       str							,					__UpperCAmelCase							:       str):
      return self.format_bin(self.hash_(__UpperCAmelCase))






    @property
    def       __snake_case				(   self							:       Union[str, Any]):
      a		:						str 				=     bin(self.bitarray).count("1")
      return (n_ones / self.size) ** len(__UpperCAmelCase)










"""simple docstring"""







def 	lowercase     (							A_    ,  A_			)-> list[tuple[int, int, int]]:
  '''simple docstring'''







  a		:						Union[str, Any] 				=     sorted(A_    ,  key=lambda A_			: edge[2]			)

  a		:						List[Any] 				=     list(range(A_			)			)

  def find_parent(A_			):
    if i != parent[i]:
      a		:						Dict 				=     find_parent(parent[i]			)
    return parent[i]

  a		:						Optional[Any] 				=     0
  a		:						Optional[int] 				=     []

  for edge in edges:
    a		:						List[str] 				=     find_parent(edge[0]			)
    a		:						int 				=     find_parent(edge[1]			)
    if parent_a != parent_b:
      minimum_spanning_tree_cost += edge[2]
      minimum_spanning_tree.append(A_			)
      a		:						Tuple 				=     parent_b

  return minimum_spanning_tree


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

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

 kruskal(num_nodes, edges)






