






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase__			 =	{
    'configuration_musicgen': [
        'MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'MusicgenConfig',
        'MusicgenDecoderConfig',
    ],
    'processing_musicgen': ['MusicgenProcessor'],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase__			 =	[
		    'MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'MusicgenForConditionalGeneration',
		    'MusicgenForCausalLM',
		    'MusicgenModel',
		    'MusicgenPreTrainedModel',
		]

if TYPE_CHECKING:
		from .configuration_musicgen import (
		    MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    MusicgenConfig,
		    MusicgenDecoderConfig,
		)
		from .processing_musicgen import MusicgenProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_musicgen import (
				    MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST,
				    MusicgenForCausalLM,
				    MusicgenForConditionalGeneration,
				    MusicgenModel,
				    MusicgenPreTrainedModel,
				)

else:
		import sys

		UpperCAmelCase__			 =	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)













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



					"""simple docstring"""
					__a				:	str			=				sorted(__A							,					key=lambda __A			: edge[2]			)

					__a				:	int			=				list(range(__A			)			)

					def find_parent(__A			):
										if i != parent[i]:
															__a				:	Optional[Any]			=				find_parent(parent[i]			)
										return parent[i]

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

					for edge in edges:
										__a				:	Any			=				find_parent(edge[0]			)
										__a				:	Optional[Any]			=				find_parent(edge[1]			)
										if parent_a != parent_b:
															minimum_spanning_tree_cost += edge[2]
															minimum_spanning_tree.append(__A			)
															__a				:	List[str]			=				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)





