




'''simple docstring'''






import math
from timeit import timeit




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       lowercase  :		Dict						=      0
       lowercase  :		Union[str, Any]						=      abs(lowerCamelCase      )
       while True:
              lowercase  :		List[Any]						=      n // 10
              digits += 1
              if n == 0:
                     break
       return digits




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       return 1 if n == 0 else math.floor(math.log(abs(lowerCamelCase      )   ,				10      ) + 1      )




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       return len(str(abs(lowerCamelCase      )      )      )




def 		a_( )				->None:






       '''simple docstring'''




       from collections.abc import Callable

       def benchmark_a_function(lowerCamelCase   ,				lowerCamelCase      ) -> None:
              lowercase  :		str						=      f"""{func.__name__}({value})"""
              lowercase  :		Optional[Any]						=      timeit(f"""__main__.{call}"""   ,				setup='''import __main__'''      )
              print(f"""{call}: {func(lowerCamelCase      )} -- {timing} seconds"""      )

       for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
              for func in (num_digits, num_digits_fast, num_digits_faster):
                     benchmark_a_function(lowerCamelCase   ,				lowerCamelCase      )
              print()


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      benchmark()










'''simple docstring'''






def 		a_( lowerCamelCase   ,				lowerCamelCase      )				->list[tuple[int, int, int]]:






       '''simple docstring'''




       lowercase  :		Dict						=      sorted(lowerCamelCase   ,				key=lambda lowerCamelCase      : edge[2]      )

       lowercase  :		str						=      list(range(lowerCamelCase      )      )

       def find_parent(lowerCamelCase      ):
              if i != parent[i]:
                     lowercase  :		Optional[int]						=      find_parent(parent[i]      )
              return parent[i]

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

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

       return minimum_spanning_tree


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

      for _ in range(num_edges):
            lowercase	,	lowercase	,	lowercase	:      Optional[Any]				=       (int(x) for x in input().strip().split())
            edges.append((nodea, nodea, cost))

      kruskal(num_nodes, edges)




