
import sys
from collections import defaultdict



class    a_ :






			def __init__(      self  ):
									_lowercase					       =					[]






			def    UpperCamelCase_				(      self				,			__UpperCamelCase  ):
									return self.node_position[vertex]






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase  ):
									_lowercase					       =					pos






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase				,			__UpperCamelCase				,			__UpperCamelCase  ):
									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]				,			__UpperCamelCase  )

																					self.top_to_bottom(__UpperCamelCase				,			__UpperCamelCase				,			__UpperCamelCase				,			__UpperCamelCase  )






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase				,			__UpperCamelCase				,			__UpperCamelCase  ):
									_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]				,			__UpperCamelCase  )
															else:
																					_lowercase					       =					val
																					_lowercase					       =					temp
																					self.set_position(__UpperCamelCase				,			__UpperCamelCase  )
																					break
															_lowercase					       =					parent
									else:
															_lowercase					       =					val
															_lowercase					       =					temp
															self.set_position(__UpperCamelCase				,			0  )






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase  ):
									_lowercase					       =					len(__UpperCamelCase  ) // 2 - 1
									for i in range(__UpperCamelCase				,			-1				,			-1  ):
															self.top_to_bottom(__UpperCamelCase				,			__UpperCamelCase				,			len(__UpperCamelCase  )				,			__UpperCamelCase  )






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase  ):
									_lowercase					       =					positions[0]
									_lowercase					       =					sys.maxsize
									self.top_to_bottom(__UpperCamelCase				,			0				,			len(__UpperCamelCase  )				,			__UpperCamelCase  )
									return temp







def 	UpperCamelCase__  (     SCREAMING_SNAKE_CASE_	:	int       )  ->     str:
						_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 --------- >
		A		: Any								=     int(input('''Enter number of edges: ''').strip())
		A		: Tuple								=     defaultdict(list)
		for _ in range(edges_number):
				A		: str								=     [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 OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A		: Dict								=     {
    '''configuration_x_clip''': [
        '''XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''XCLIPConfig''',
        '''XCLIPTextConfig''',
        '''XCLIPVisionConfig''',
    ],
    '''processing_x_clip''': ['''XCLIPProcessor'''],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A		: Optional[Any]								=     [
		    '''XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''XCLIPModel''',
		    '''XCLIPPreTrainedModel''',
		    '''XCLIPTextModel''',
		    '''XCLIPVisionModel''',
		]

if TYPE_CHECKING:
		from .configuration_x_clip import (
		    XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    XCLIPConfig,
		    XCLIPTextConfig,
		    XCLIPVisionConfig,
		)
		from .processing_x_clip import XCLIPProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_x_clip import (
				    XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
				    XCLIPModel,
				    XCLIPPreTrainedModel,
				    XCLIPTextModel,
				    XCLIPVisionModel,
				)

else:
		import sys

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