


'''simple docstring'''
import sys
from collections import defaultdict




class        _UpperCamelCase	:


				'''simple docstring'''


				def __init__(     self							)    ->  Any:
					lowercase						:		int   					=		[]

				def 	a__		(     self							,      a_							)    ->  Any:
					return self.node_position[vertex]

				def 	a__		(     self							,      a_							,      a_							)    ->  str:
					lowercase						:		Optional[int]   					=		pos

				def 	a__		(     self							,      a_							,      a_							,      a_							,      a_							)    ->  Tuple:
					if start > size // 2 - 1:
						return
					else:
						if 2 * start + 2 >= size:
							lowercase						:		Union[str, Any]   					=		2 * start + 1
						else:
							if heap[2 * start + 1] < heap[2 * start + 2]:
								lowercase						:		Optional[int]   					=		2 * start + 1
							else:
								lowercase						:		Optional[int]   					=		2 * start + 2
						if heap[smallest_child] < heap[start]:
							lowercase					,		lowercase						:		Optional[int]   					=		heap[smallest_child], positions[smallest_child]
							lowercase					,		lowercase						:		Union[str, Any]   					=		(
							    heap[start],
							    positions[start],
							)
							lowercase					,		lowercase						:		Tuple   					=		temp, tempa

							lowercase						:		List[Any]   					=		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							,      a_							,      a_							,      a_							,      a_							)    ->  Union[str, Any]:
					lowercase						:		Optional[int]   					=		position[index]

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

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

				def 	a__		(     self							,      a_							,      a_							)    ->  Union[str, Any]:
					lowercase						:		str   					=		len(a_							) // 2 - 1
					for i in range(a_							,      -1							,      -1							):
						self.top_to_bottom(a_							,      a_							,      len(a_							)							,      a_							)


				def 	a__		(     self							,      a_							,      a_							)    ->  List[str]:
					lowercase						:		str   					=		positions[0]
					lowercase						:		List[str]   					=		sys.maxsize
					self.top_to_bottom(a_							,      0							,      len(a_							)							,      a_							)
					return temp




def 	_A  (       A							)  ->				str:
	lowercase						:		Union[str, Any]   					=		Heap()

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

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

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

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


if __name__ == "__main__":  # pragma: no cover
					# < --------- Prims Algorithm --------- >
					lowerCAmelCase   : List[str]             =				int(input("""Enter number of edges: """).strip())
					lowerCAmelCase   : Optional[int]             =				defaultdict(list)
					for _ in range(edges_number):
										lowerCAmelCase   : List[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_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowerCAmelCase   : List[Any]             =				{
    """configuration_albert""": ["""ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """AlbertConfig""", """AlbertOnnxConfig"""],
}

try:
					if not is_sentencepiece_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase   : Any             =				["""AlbertTokenizer"""]

try:
					if not is_tokenizers_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase   : Optional[Any]             =				["""AlbertTokenizerFast"""]

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase   : List[str]             =				[
					    """ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
					    """AlbertForMaskedLM""",
					    """AlbertForMultipleChoice""",
					    """AlbertForPreTraining""",
					    """AlbertForQuestionAnswering""",
					    """AlbertForSequenceClassification""",
					    """AlbertForTokenClassification""",
					    """AlbertModel""",
					    """AlbertPreTrainedModel""",
					    """load_tf_weights_in_albert""",
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase   : Tuple             =				[
					    """TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
					    """TFAlbertForMaskedLM""",
					    """TFAlbertForMultipleChoice""",
					    """TFAlbertForPreTraining""",
					    """TFAlbertForQuestionAnswering""",
					    """TFAlbertForSequenceClassification""",
					    """TFAlbertForTokenClassification""",
					    """TFAlbertMainLayer""",
					    """TFAlbertModel""",
					    """TFAlbertPreTrainedModel""",
					]

try:
					if not is_flax_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase   : Optional[int]             =				[
					    """FlaxAlbertForMaskedLM""",
					    """FlaxAlbertForMultipleChoice""",
					    """FlaxAlbertForPreTraining""",
					    """FlaxAlbertForQuestionAnswering""",
					    """FlaxAlbertForSequenceClassification""",
					    """FlaxAlbertForTokenClassification""",
					    """FlaxAlbertModel""",
					    """FlaxAlbertPreTrainedModel""",
					]

if TYPE_CHECKING:
					from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig, AlbertOnnxConfig

					try:
										if not is_sentencepiece_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_albert import AlbertTokenizer

					try:
										if not is_tokenizers_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_albert_fast import AlbertTokenizerFast

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_albert import (
										    ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
										    AlbertForMaskedLM,
										    AlbertForMultipleChoice,
										    AlbertForPreTraining,
										    AlbertForQuestionAnswering,
										    AlbertForSequenceClassification,
										    AlbertForTokenClassification,
										    AlbertModel,
										    AlbertPreTrainedModel,
										    load_tf_weights_in_albert,
										)

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_albert import (
										    TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFAlbertForMaskedLM,
										    TFAlbertForMultipleChoice,
										    TFAlbertForPreTraining,
										    TFAlbertForQuestionAnswering,
										    TFAlbertForSequenceClassification,
										    TFAlbertForTokenClassification,
										    TFAlbertMainLayer,
										    TFAlbertModel,
										    TFAlbertPreTrainedModel,
										)

					try:
										if not is_flax_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_flax_albert import (
										    FlaxAlbertForMaskedLM,
										    FlaxAlbertForMultipleChoice,
										    FlaxAlbertForPreTraining,
										    FlaxAlbertForQuestionAnswering,
										    FlaxAlbertForSequenceClassification,
										    FlaxAlbertForTokenClassification,
										    FlaxAlbertModel,
										    FlaxAlbertPreTrainedModel,
										)
else:
					import sys

					lowerCAmelCase   : Union[str, Any]             =				_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


