



import sys
from collections import defaultdict
class 			_snake_case     :




				def __init__(  self   :  List[str]  ):
							lowercase__   					=			[]




				def 							A__ (  self   :  Optional[int],   __lowercase   :  str  ):
							return self.node_position[vertex]




				def 							A__ (  self   :  int,   __lowercase   :  List[Any],   __lowercase   :  Optional[int]  ):
							lowercase__   					=			pos




				def 							A__ (  self   :  Tuple,   __lowercase   :  Dict,   __lowercase   :  List[str],   __lowercase   :  int,   __lowercase   :  Optional[int]  ):
							if start > size // 2 - 1:
										return
							else:
										if 2 * start + 2 >= size:
													lowercase__   					=			2 * start + 1
										else:
													if heap[2 * start + 1] < heap[2 * start + 2]:
																lowercase__   					=			2 * start + 1
													else:
																lowercase__   					=			2 * start + 2
										if heap[smallest_child] < heap[start]:
													lowercase__					,    lowercase__   					=			heap[smallest_child], positions[smallest_child]
													lowercase__					,    lowercase__   					=			(
													    heap[start],
													    positions[start],
													)
													lowercase__					,    lowercase__   					=			temp, tempa

													lowercase__   					=			self.get_position(positions[smallest_child]  )
													self.set_position(
													    positions[smallest_child],   self.get_position(positions[start]  )  )
													self.set_position(positions[start],   __lowercase  )

													self.top_to_bottom(__lowercase,   __lowercase,   __lowercase,   __lowercase  )




				def 							A__ (  self   :  int,   __lowercase   :  Tuple,   __lowercase   :  List[str],   __lowercase   :  Union[str, Any],   __lowercase   :  Any  ):
							lowercase__   					=			position[index]

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

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




				def 							A__ (  self   :  Dict,   __lowercase   :  Any,   __lowercase   :  Tuple  ):
							lowercase__   					=			len(__lowercase  ) // 2 - 1
							for i in range(__lowercase,   -1,   -1  ):
										self.top_to_bottom(__lowercase,   __lowercase,   len(__lowercase  ),   __lowercase  )




				def 							A__ (  self   :  Any,   __lowercase   :  str,   __lowercase   :  int  ):
							lowercase__   					=			positions[0]
							lowercase__   					=			sys.maxsize
							self.top_to_bottom(__lowercase,   0,   len(__lowercase  ),   __lowercase  )
							return temp



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_					):
			lowercase__   					=			Heap()

			lowercase__   					=			[0] * len(SCREAMING_SNAKE_CASE_					)
			lowercase__   					=			[-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
			lowercase__   					=			[]  # Heap of Distance of vertices from their neighboring vertex
			lowercase__   					=			[]

			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_					)

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

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


if __name__ == "__main__":  # pragma: no cover
							# < --------- Prims Algorithm --------- >
							lowercase_						=       int(input("""Enter number of edges: """).strip())
							lowercase_						=       defaultdict(list)
							for _ in range(edges_number):
														lowercase_						=       [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 fire

from utils import calculate_rouge, save_json



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_=None  ,					**SCREAMING_SNAKE_CASE_					):
			lowercase__   					=			[x.strip() for x in open(SCREAMING_SNAKE_CASE_					).readlines()]
			lowercase__   					=			[x.strip() for x in open(SCREAMING_SNAKE_CASE_					).readlines()][: len(SCREAMING_SNAKE_CASE_					)]
			lowercase__   					=			calculate_rouge(SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_  ,					**SCREAMING_SNAKE_CASE_					)
			if save_path is not None:
						save_json(SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_  ,					indent=SCREAMING_SNAKE_CASE_					)
			return metrics  # these print nicely


if __name__ == "__main__":
							fire.Fire(calculate_rouge_path)




