






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





						"""simple docstring"""



						_UpperCAmelCase             =    sorted(__lowerCAmelCase				,	key=lambda __lowerCAmelCase			: edge[2]			)

						_UpperCAmelCase             =    list(range(__lowerCAmelCase			)			)

						def find_parent(__lowerCAmelCase			):
												if i != parent[i]:
																		_UpperCAmelCase             =    find_parent(parent[i]			)
												return parent[i]

						_UpperCAmelCase             =    0
						_UpperCAmelCase             =    []

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

						return minimum_spanning_tree


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

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

		kruskal(num_nodes, edges)








from typing import Any





class __lowerCamelCase				:





	"""simple docstring"""






	def __init__(							self					):
							"""simple docstring"""







							_UpperCAmelCase             =    []
							_UpperCAmelCase             =    0

	def __str__(							self					):
							"""simple docstring"""







							_UpperCAmelCase             =    '<' + str(self.stack					)[1:-1] + '>'
							return printed

	def  UpperCamelCase					(							self ,					UpperCAmelCase					):
							"""simple docstring"""







							self.stack.append(UpperCAmelCase					)
							_UpperCAmelCase             =    self.length + 1

	def  UpperCamelCase					(							self					):
							"""simple docstring"""







							self.rotate(1					)
							_UpperCAmelCase             =    self.stack[self.length - 1]
							_UpperCAmelCase             =    self.stack[:-1]
							self.rotate(self.length - 1					)
							_UpperCAmelCase             =    self.length - 1
							return dequeued

	def  UpperCamelCase					(							self ,					UpperCAmelCase					):
							"""simple docstring"""







							for _ in range(UpperCAmelCase					):
													_UpperCAmelCase             =    self.stack[0]
													_UpperCAmelCase             =    self.stack[1:]
													self.put(UpperCAmelCase					)
													_UpperCAmelCase             =    self.length - 1

	def  UpperCamelCase					(							self					):
							"""simple docstring"""







							_UpperCAmelCase             =    self.get()
							self.put(UpperCAmelCase					)
							self.rotate(self.length - 1					)
							return front

	def  UpperCamelCase					(							self					):
							"""simple docstring"""







							return self.length
