



'''simple docstring'''
def 	lowercase_						( lowerCAmelCase__						:	int      ,				lowerCAmelCase__						:	list[tuple[int, int, int]]			):

			"""simple docstring"""





			__UpperCAmelCase :   Any    					=  sorted(lowerCAmelCase__      ,				key=lambda lowerCAmelCase__			: edge[2]			)

			__UpperCAmelCase :   int    					=  list(range(lowerCAmelCase__			)			)

			def find_parent(lowerCAmelCase__						:	Union[str, Any]			):
						if i != parent[i]:
									__UpperCAmelCase :   str    					=  find_parent(parent[i]			)
						return parent[i]

			__UpperCAmelCase :   int    					=  0
			__UpperCAmelCase :   List[Any]    					=  []

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

			return minimum_spanning_tree


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

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

					kruskal(num_nodes, edges)









'''simple docstring'''
import inspect
import os
import unittest

import torch

import accelerate
from accelerate import debug_launcher
from accelerate.test_utils import (
    execute_subprocess_async,
    require_cpu,
    require_multi_gpu,
    require_single_gpu,
    test_sync,
)
from accelerate.utils import patch_environment



class _A	(     unittest.TestCase     ):





		def 				__A							(  self					)							->  Optional[Any]:

					'''simple docstring'''
					__UpperCAmelCase :   int    					=  inspect.getfile(accelerate.test_utils					)
					__UpperCAmelCase :   int    					=  os.path.sep.join(mod_file.split(os.path.sep					)[:-1] + ["""scripts""", """test_sync.py"""]					)





		@require_cpu
		def 				__A							(  self					)							->  Optional[Any]:

					'''simple docstring'''
					debug_launcher(test_sync.main			,							num_processes=1					)





		@require_cpu
		def 				__A							(  self					)							->  Optional[Any]:

					'''simple docstring'''
					debug_launcher(test_sync.main					)





		@require_single_gpu
		def 				__A							(  self					)							->  Tuple:

					'''simple docstring'''
					test_sync.main()





		@require_multi_gpu
		def 				__A							(  self					)							->  List[Any]:

					'''simple docstring'''
					print(f'Found {torch.cuda.device_count()} devices.'					)
					__UpperCAmelCase :   List[str]    					=  ["""torchrun""", f'--nproc_per_node={torch.cuda.device_count()}', self.test_file_path]
					with patch_environment(omp_num_threads=1					):
								execute_subprocess_async(__UpperCAmelCase			,							env=os.environ.copy()					)




