






'''simple docstring'''





import sys
from collections import defaultdict


class  snake_case__      :




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




					def 		A      (  self  :		Optional[Any]				, _A  :		List[Any]      )    ->							List[Any]:
								return self.node_position[vertex]




					def 		A      (  self  :		int				, _A  :		str				, _A  :		List[str]      )    ->							Tuple:
								UpperCAmelCase_      :       Tuple          =       pos




					def 		A      (  self  :		Union[str, Any]				, _A  :		Union[str, Any]				, _A  :		Optional[Any]				, _A  :		List[str]				, _A  :		Union[str, Any]      )    ->							str:
								if start > size // 2 - 1:
											return
								else:
											if 2 * start + 2 >= size:
														UpperCAmelCase_      :       str          =       2 * start + 1
											else:
														if heap[2 * start + 1] < heap[2 * start + 2]:
																	UpperCAmelCase_      :       str          =       2 * start + 1
														else:
																	UpperCAmelCase_      :       Optional[Any]          =       2 * start + 2
											if heap[smallest_child] < heap[start]:
														UpperCAmelCase_    ,      UpperCAmelCase_      :       str          =       heap[smallest_child], positions[smallest_child]
														UpperCAmelCase_    ,      UpperCAmelCase_      :       List[Any]          =       (
														    heap[start],
														    positions[start],
														)
														UpperCAmelCase_    ,      UpperCAmelCase_      :       str          =       temp, tempa

														UpperCAmelCase_      :       Optional[int]          =       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 		A      (  self  :		List[str]				, _A  :		str				, _A  :		List[str]				, _A  :		List[Any]				, _A  :		Dict      )    ->							Optional[int]:
								UpperCAmelCase_      :       Tuple          =       position[index]

								while index != 0:
											UpperCAmelCase_      :       Optional[Any]          =       int((index - 2) / 2      ) if index % 2 == 0 else int((index - 1) / 2      )

											if val < heap[parent]:
														UpperCAmelCase_      :       List[str]          =       heap[parent]
														UpperCAmelCase_      :       Dict          =       position[parent]
														self.set_position(position[parent]				, _A      )
											else:
														UpperCAmelCase_      :       Optional[Any]          =       val
														UpperCAmelCase_      :       Optional[Any]          =       temp
														self.set_position(_A				, _A      )
														break
											UpperCAmelCase_      :       str          =       parent
								else:
											UpperCAmelCase_      :       Any          =       val
											UpperCAmelCase_      :       Optional[Any]          =       temp
											self.set_position(_A				, 0      )




					def 		A      (  self  :		Dict				, _A  :		Any				, _A  :		List[Any]      )    ->							int:
								UpperCAmelCase_      :       Tuple          =       len(_A      ) // 2 - 1
								for i in range(_A				, -1				, -1      ):
											self.top_to_bottom(_A				, _A				, len(_A      )				, _A      )





					def 		A      (  self  :		Optional[int]				, _A  :		str				, _A  :		Dict      )    ->							Any:
								UpperCAmelCase_      :       List[str]          =       positions[0]
								UpperCAmelCase_      :       str          =       sys.maxsize
								self.top_to_bottom(_A				, 0				, len(_A      )				, _A      )
								return temp






def __UpperCAmelCase   (					A					:			Dict		)    ->   List[str]:
			UpperCAmelCase_      :       Tuple          =       Heap()

			UpperCAmelCase_      :       Tuple          =       [0] * len(A		)
			UpperCAmelCase_      :       List[str]          =       [-1] * len(A		)  # Neighboring Tree Vertex of selected vertex
			# Minimum Distance of explored vertex with neighboring vertex of partial tree
			# formed in graph
			UpperCAmelCase_      :       Any          =       []  # Heap of Distance of vertices from their neighboring vertex
			UpperCAmelCase_      :       int          =       []

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

			UpperCAmelCase_      :       Any          =       []
			UpperCAmelCase_      :       Optional[int]          =       1
			UpperCAmelCase_      :       str          =       sys.maxsize
			for neighbor, distance in adjacency_list[0]:
						UpperCAmelCase_      :       List[Any]          =       0
						UpperCAmelCase_      :       str          =       distance
			heap.heapify(A			,       A		)

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


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










'''simple docstring'''





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available


_UpperCamelCase						:						Tuple  =					{
    'configuration_audio_spectrogram_transformer': [
        'AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'ASTConfig',
    ]
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						_UpperCamelCase						:						Optional[int]  =					[
						    'AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'ASTForAudioClassification',
						    'ASTModel',
						    'ASTPreTrainedModel',
						]

try:
						if not is_speech_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						_UpperCamelCase						:						int  =					['ASTFeatureExtractor']

if TYPE_CHECKING:
						from .configuration_audio_spectrogram_transformer import (
						    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    ASTConfig,
						)

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_audio_spectrogram_transformer import (
												    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    ASTForAudioClassification,
												    ASTModel,
												    ASTPreTrainedModel,
												)

						try:
												if not is_speech_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_audio_spectrogram_transformer import ASTFeatureExtractor


else:
						import sys

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


