






import numpy as np







def 						a_      (__A							,					__A							,					__A			)							->	str:



					"""simple docstring"""
					__a				:	List[str]			=				n_draws * class_counts / class_counts.sum()
					# floored means we don't overshoot n_samples, but probably undershoot
					__a				:	List[str]			=				np.floor(__A			)
					# we add samples according to how much "left over" probability
					# they had, until we arrive at n_samples
					__a				:	Union[str, Any]			=				int(n_draws - floored.sum()			)
					if need_to_add > 0:
										__a				:	str			=				continuous - floored
										__a				:	int			=				np.sort(np.unique(__A			)			)[::-1]
										# add according to remainder, but break ties
										# randomly to avoid biases
										for value in values:
															((__a)			, )				:	str			=				np.where(remainder == value			)
															# if we need_to_add less than what's in inds
															# we draw randomly from them.
															# if we need to add more, we add them all and
															# go to the next value
															__a				:	List[Any]			=				min(len(__A			)							,					__A			)
															__a				:	Tuple			=				rng.choice(__A							,					size=__A							,					replace=__A			)
															floored[inds] += 1
															need_to_add -= add_now
															if need_to_add == 0:
																				break
					return floored.astype(np.intaa			)







def 						a_      (__A							,					__A							,					__A							,					__A							,					__A=10			)							->	List[Any]:



					"""simple docstring"""
					__a			, __a				:	Optional[int]			=				np.unique(__A							,					return_inverse=__A			)
					__a				:	List[str]			=				classes.shape[0]
					__a				:	List[str]			=				np.bincount(__A			)
					if np.min(__A			) < 2:
										raise ValueError("Minimum class count error"			)
					if n_train < n_classes:
										raise ValueError(
										    "The train_size = %d should be greater or " "equal to the number of classes = %d" % (n_train, n_classes)			)
					if n_test < n_classes:
										raise ValueError(
										    "The test_size = %d should be greater or " "equal to the number of classes = %d" % (n_test, n_classes)			)
					__a				:	List[Any]			=				np.split(np.argsort(__A							,					kind="mergesort"			)							,					np.cumsum(__A			)[:-1]			)
					for _ in range(__A			):
										__a				:	int			=				approximate_mode(__A							,					__A							,					__A			)
										__a				:	str			=				class_counts - n_i
										__a				:	int			=				approximate_mode(__A							,					__A							,					__A			)

										__a				:	List[str]			=				[]
										__a				:	int			=				[]

										for i in range(__A			):
															__a				:	Dict			=				rng.permutation(class_counts[i]			)
															__a				:	List[Any]			=				class_indices[i].take(__A							,					mode="clip"			)
															train.extend(perm_indices_class_i[: n_i[i]]			)
															test.extend(perm_indices_class_i[n_i[i] : n_i[i] + t_i[i]]			)
										__a				:	Dict			=				rng.permutation(__A			)
										__a				:	Dict			=				rng.permutation(__A			)

										yield train, test













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)





