





import sys
from collections import defaultdict


class   A      :
			'''simple docstring'''




			def __init__(      self       :   Union[str, Any]       )     ->     int:







					"""simple docstring"""






					A__  				=       []






			def        a_	(      self       :   Union[str, Any]							,     __lowerCAmelCase       :   Optional[Any]       )     ->     List[Any]:







					"""simple docstring"""






					return self.node_position[vertex]






			def        a_	(      self       :   str							,     __lowerCAmelCase       :   Any							,     __lowerCAmelCase       :   Optional[Any]       )     ->     Union[str, Any]:







					"""simple docstring"""






					A__  				=       pos






			def        a_	(      self       :   List[str]							,     __lowerCAmelCase       :   Any							,     __lowerCAmelCase       :   Union[str, Any]							,     __lowerCAmelCase       :   Optional[int]							,     __lowerCAmelCase       :   Tuple       )     ->     int:







					"""simple docstring"""






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

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

									self.top_to_bottom(__lowerCAmelCase							,     __lowerCAmelCase							,     __lowerCAmelCase							,     __lowerCAmelCase       )






			def        a_	(      self       :   Any							,     __lowerCAmelCase       :   Tuple							,     __lowerCAmelCase       :   Any							,     __lowerCAmelCase       :   Union[str, Any]							,     __lowerCAmelCase       :   Dict       )     ->     Tuple:







					"""simple docstring"""






					A__  				=       position[index]

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

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






			def        a_	(      self       :   str							,     __lowerCAmelCase       :   str							,     __lowerCAmelCase       :   Tuple       )     ->     Optional[int]:







					"""simple docstring"""






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







			def        a_	(      self       :   Union[str, Any]							,     __lowerCAmelCase       :   List[Any]							,     __lowerCAmelCase       :   Optional[int]       )     ->     Union[str, Any]:







					"""simple docstring"""






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







def        __lowerCamelCase (							__a       :List[Any]   )		->    List[Any]:






		"""simple docstring"""

		A__  				=       Heap()

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

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

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

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


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










from typing import TYPE_CHECKING

from ...utils import _LazyModule


A   : Optional[Any]			=				{'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']}


if TYPE_CHECKING:
					from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM
else:
					import sys

					A   : List[str]			=				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



