




import sys
from collections import defaultdict
class       a__   :






						def __init__(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	[]






						def     __SCREAMING_SNAKE_CASE(       self		,      _A      ):




											"""simple docstring"""



											return self.node_position[vertex]






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase           =	pos






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A		,      _A		,      _A      ):




											"""simple docstring"""



											if start > size // 2 - 1:
																return
											else:
																if 2 * start + 2 >= size:
																					__lowerCAmelCase           =	2 * start + 1
																else:
																					if heap[2 * start + 1] < heap[2 * start + 2]:
																										__lowerCAmelCase           =	2 * start + 1
																					else:
																										__lowerCAmelCase           =	2 * start + 2
																if heap[smallest_child] < heap[start]:
																					__lowerCAmelCase       ,							__lowerCAmelCase           =	heap[smallest_child], positions[smallest_child]
																					__lowerCAmelCase       ,							__lowerCAmelCase           =	(
																					    heap[start],
																					    positions[start],
																					)
																					__lowerCAmelCase       ,							__lowerCAmelCase           =	temp, tempa

																					__lowerCAmelCase           =	self.get_position(positions[smallest_child]      )
																					self.set_position(
																					    positions[smallest_child]		,      self.get_position(positions[start]      )      )
																					self.set_position(positions[start]		,      _A      )

																					self.top_to_bottom(_A		,      _A		,      _A		,      _A      )






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A		,      _A		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase           =	position[index]

											while index != 0:
																__lowerCAmelCase           =	int((index - 2) / 2      ) if index % 2 == 0 else int((index - 1) / 2      )

																if val < heap[parent]:
																					__lowerCAmelCase           =	heap[parent]
																					__lowerCAmelCase           =	position[parent]
																					self.set_position(position[parent]		,      _A      )
																else:
																					__lowerCAmelCase           =	val
																					__lowerCAmelCase           =	temp
																					self.set_position(_A		,      _A      )
																					break
																__lowerCAmelCase           =	parent
											else:
																__lowerCAmelCase           =	val
																__lowerCAmelCase           =	temp
																self.set_position(_A		,      0      )






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase           =	len(_A      ) // 2 - 1
											for i in range(_A		,      -1		,      -1      ):
																self.top_to_bottom(_A		,      _A		,      len(_A      )		,      _A      )






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase           =	positions[0]
											__lowerCAmelCase           =	sys.maxsize
											self.top_to_bottom(_A		,      0		,      len(_A      )		,      _A      )
											return temp







def      _a				(						SCREAMING_SNAKE_CASE_							:    Union[str, Any]					):
					__lowerCAmelCase           =	Heap()

					__lowerCAmelCase           =	[0] * len(SCREAMING_SNAKE_CASE_					)
					__lowerCAmelCase           =	[-1] * len(SCREAMING_SNAKE_CASE_					)  # Neighboring Tree Vertex of selected vertex
					# Minimum Distance of explored vertex with neighboring vertex of partial tree
					# formed in graph
					__lowerCAmelCase           =	[]  # Heap of Distance of vertices from their neighboring vertex
					__lowerCAmelCase           =	[]

					for vertex in range(len(SCREAMING_SNAKE_CASE_					)					):
										distance_tv.append(sys.maxsize					)
										positions.append(SCREAMING_SNAKE_CASE_					)
										heap.node_position.append(SCREAMING_SNAKE_CASE_					)

					__lowerCAmelCase           =	[]
					__lowerCAmelCase           =	1
					__lowerCAmelCase           =	sys.maxsize
					for neighbor, distance in adjacency_list[0]:
										__lowerCAmelCase           =	0
										__lowerCAmelCase           =	distance
					heap.heapify(SCREAMING_SNAKE_CASE_				,				SCREAMING_SNAKE_CASE_					)

					for _ in range(1				,				len(SCREAMING_SNAKE_CASE_					)					):
										__lowerCAmelCase           =	heap.delete_minimum(SCREAMING_SNAKE_CASE_				,				SCREAMING_SNAKE_CASE_					)
										if visited[vertex] == 0:
															tree_edges.append((nbr_tv[vertex], vertex)					)
															__lowerCAmelCase           =	1
															for neighbor, distance in adjacency_list[vertex]:
																				if (
																				    visited[neighbor] == 0
																				    and distance < distance_tv[heap.get_position(SCREAMING_SNAKE_CASE_					)]
																				):
																									__lowerCAmelCase           =	distance
																									heap.bottom_to_top(
																									    SCREAMING_SNAKE_CASE_				,				heap.get_position(SCREAMING_SNAKE_CASE_					)				,				SCREAMING_SNAKE_CASE_				,				SCREAMING_SNAKE_CASE_					)
																									__lowerCAmelCase           =	vertex
					return tree_edges


if __name__ == "__main__":  # pragma: no cover
					# < --------- Prims Algorithm --------- >
					UpperCamelCase__         =      int(input("""Enter number of edges: """).strip())
					UpperCamelCase__         =      defaultdict(list)
					for _ in range(edges_number):
										UpperCamelCase__         =      [int(x) for x in input().strip().split()]
										adjacency_list[edge[0]].append([edge[1], edge[2]])
										adjacency_list[edge[1]].append([edge[0], edge[2]])
					print(prisms_algorithm(adjacency_list))










import math







def      _a				(						SCREAMING_SNAKE_CASE_							:    int					):

					if 1 < number < 4:
										# 2 and 3 are primes
										return True
					elif number < 2 or number % 2 == 0 or number % 3 == 0:
										# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
										return False

					# All primes number are in format of 6k +/- 1
					for i in range(5				,				int(math.sqrt(SCREAMING_SNAKE_CASE_					) + 1					)				,				6					):
										if number % i == 0 or number % (i + 2) == 0:
															return False
					return True







def      _a				(						SCREAMING_SNAKE_CASE_							:    int = 1_00_01					):

					try:
										__lowerCAmelCase           =	int(SCREAMING_SNAKE_CASE_					)
					except (TypeError, ValueError):
										raise TypeError("Parameter nth must be int or castable to int."					) from None
					if nth <= 0:
										raise ValueError("Parameter nth must be greater than or equal to one."					)
					__lowerCAmelCase           =	[]
					__lowerCAmelCase           =	2
					while len(SCREAMING_SNAKE_CASE_					) < nth:
										if is_prime(SCREAMING_SNAKE_CASE_					):
															primes.append(SCREAMING_SNAKE_CASE_					)
															num += 1
										else:
															num += 1
					return primes[len(SCREAMING_SNAKE_CASE_					) - 1]


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




