from __future__ import annotations





def   lowerCAmelCase_ (				__lowerCAmelCase		,					__lowerCAmelCase		,					__lowerCAmelCase						)->  tuple[float, float]:






      '''simple docstring'''





      assert (
          c % greatest_common_divisor(__lowerCAmelCase		,					__lowerCAmelCase						) == 0
      )  # greatest_common_divisor(a,b) function implemented below
      ((UpperCAmelCase)  ,						(UpperCAmelCase)  ,						(UpperCAmelCase))    : Optional[int]      =extended_gcd(__lowerCAmelCase		,					__lowerCAmelCase						)  # extended_gcd(a,b) function implemented below
      UpperCAmelCase    : str      =c / d
      return (r * x, r * y)





def   lowerCAmelCase_ (				__lowerCAmelCase		,					__lowerCAmelCase		,					__lowerCAmelCase		,					__lowerCAmelCase = 2						)->  None:






      '''simple docstring'''





      ((UpperCAmelCase)  ,						(UpperCAmelCase))    : Tuple      =diophantine(__lowerCAmelCase		,					__lowerCAmelCase		,					__lowerCAmelCase						)  # Initial value
      UpperCAmelCase    : Optional[int]      =greatest_common_divisor(__lowerCAmelCase		,					__lowerCAmelCase						)
      UpperCAmelCase    : Any      =a // d
      UpperCAmelCase    : List[Any]      =b // d

      for i in range(__lowerCAmelCase						):
            UpperCAmelCase    : Union[str, Any]      =xa + i * q
            UpperCAmelCase    : int      =ya - i * p
            print(__lowerCAmelCase		,					__lowerCAmelCase						)





def   lowerCAmelCase_ (				__lowerCAmelCase		,					__lowerCAmelCase						)->  int:






      '''simple docstring'''





      if a < b:
            UpperCAmelCase  ,						UpperCAmelCase    : Optional[int]      =b, a

      while a % b != 0:
            UpperCAmelCase  ,						UpperCAmelCase    : Optional[Any]      =b, a % b

      return b





def   lowerCAmelCase_ (				__lowerCAmelCase		,					__lowerCAmelCase						)->  tuple[int, int, int]:






      '''simple docstring'''





      assert a >= 0 and b >= 0

      if b == 0:
            UpperCAmelCase  ,						UpperCAmelCase  ,						UpperCAmelCase    : List[str]      =a, 1, 0
      else:
            ((UpperCAmelCase)  ,						(UpperCAmelCase)  ,						(UpperCAmelCase))    : Union[str, Any]      =extended_gcd(__lowerCAmelCase		,					a % b						)
            UpperCAmelCase    : Union[str, Any]      =q
            UpperCAmelCase    : Dict      =p - q * (a // b)

      assert a % d == 0 and b % d == 0
      assert d == a * x + b * y

      return (d, x, y)


if __name__ == "__main__":
     from doctest import testmod

     testmod(name='''diophantine''', verbose=True)
     testmod(name='''diophantine_all_soln''', verbose=True)
     testmod(name='''extended_gcd''', verbose=True)
     testmod(name='''greatest_common_divisor''', verbose=True)

def   lowerCAmelCase_ (				__lowerCAmelCase		,					__lowerCAmelCase						)->  list[tuple[int, int, int]]:






      '''simple docstring'''





      UpperCAmelCase    : List[Any]      =sorted(__lowerCAmelCase		,					key=lambda __lowerCAmelCase						: edge[2]						)

      UpperCAmelCase    : Union[str, Any]      =list(range(__lowerCAmelCase						)						)

      def find_parent(__lowerCAmelCase						):
            if i != parent[i]:
                  UpperCAmelCase    : Optional[int]      =find_parent(parent[i]						)
            return parent[i]

      UpperCAmelCase    : Optional[Any]      =0
      UpperCAmelCase    : List[str]      =[]

      for edge in edges:
            UpperCAmelCase    : Dict      =find_parent(edge[0]						)
            UpperCAmelCase    : Optional[Any]      =find_parent(edge[1]						)
            if parent_a != parent_b:
                  minimum_spanning_tree_cost += edge[2]
                  minimum_spanning_tree.append(__lowerCAmelCase						)
                  UpperCAmelCase    : Optional[Any]      =parent_b

      return minimum_spanning_tree


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

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

     kruskal(num_nodes, edges)
