




def 							__SCREAMING_SNAKE_CASE						(    snake_case_			,					snake_case_		):

						'''simple docstring'''


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

						_UpperCAmelCase									=  list(range(snake_case_		)		)

						def find_parent(snake_case_		):
												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(snake_case_		)
																		_UpperCAmelCase									=  parent_b

						return minimum_spanning_tree


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

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

				kruskal(num_nodes, edges)










def 							__SCREAMING_SNAKE_CASE						(    snake_case_ = 99_8001		):

						'''simple docstring'''


						for number in range(n - 1			,					9999			,					-1		):
												_UpperCAmelCase									=  str(snake_case_		)

												# checks whether 'str_number' is a palindrome.
												if str_number == str_number[::-1]:
																		_UpperCAmelCase									=  999

																		# if 'number' is a product of two 3-digit numbers
																		# then number is the answer otherwise fetch next number.
																		while divisor != 99:
																								if (number % divisor == 0) and (len(str(number // divisor		)		) == 3.0):
																														return number
																								divisor -= 1
						raise ValueError("That number is larger than our acceptable range."		)


if __name__ == "__main__":
				print(f"""{solution() = }""")




