'''simple docstring'''




import sys
from collections import defaultdict






class 							a__:


			'''simple docstring'''






			def __init__(  self):




					"""simple docstring"""


					lowerCAmelCase     =    []



			def 				a_			(  self			,       __lowerCAmelCase):




					"""simple docstring"""


					return self.node_position[vertex]



			def 				a_			(  self			,       __lowerCAmelCase			,       __lowerCAmelCase):




					"""simple docstring"""


					lowerCAmelCase     =    pos



			def 				a_			(  self			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase):




					"""simple docstring"""


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

									lowerCAmelCase     =    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			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase):




					"""simple docstring"""


					lowerCAmelCase     =    position[index]

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

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



			def 				a_			(  self			,       __lowerCAmelCase			,       __lowerCAmelCase):




					"""simple docstring"""


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







			def 				a_			(  self			,       __lowerCAmelCase			,       __lowerCAmelCase):




					"""simple docstring"""


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







def 							snake_case__				(     _A:   List[str]					)       ->      Dict:

		'''simple docstring'''


		lowerCAmelCase     =    Heap()

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

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

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

		for _ in range(1 ,  len(_A					)					):
				lowerCAmelCase     =    heap.delete_minimum(_A ,  _A					)
				if visited[vertex] == 0:
						tree_edges.append((nbr_tv[vertex], vertex)					)
						lowerCAmelCase     =    1
						for neighbor, distance in adjacency_list[vertex]:
								if (
								    visited[neighbor] == 0
								    and distance < distance_tv[heap.get_position(_A					)]
								):
										lowerCAmelCase     =    distance
										heap.bottom_to_top(
										    _A ,  heap.get_position(_A					) ,  _A ,  _A					)
										lowerCAmelCase     =    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))





'''simple docstring'''




from __future__ import annotations

import math






def 							snake_case__				(     _A:   int					)       ->      list[int]:

		'''simple docstring'''


		if num <= 0:
				lowerCAmelCase     =    f"{num}: Invalid input, please enter a positive integer."
				raise ValueError(_A					)

		lowerCAmelCase     =    [True] * (num + 1)
		lowerCAmelCase     =    []
		lowerCAmelCase     =    2
		lowerCAmelCase     =    int(math.sqrt(_A					)					)

		while start <= end:
				# If start is a prime
				if sieve[start] is True:
						prime.append(_A					)

						# Set multiples of start be False
						for i in range(start * start ,  num + 1 ,  _A					):
								if sieve[i] is True:
										lowerCAmelCase     =    False

				start += 1

		for j in range(end + 1 ,  num + 1					):
				if sieve[j] is True:
						prime.append(_A					)

		return prime


if __name__ == "__main__":
						print(prime_sieve(int(input('''Enter a positive integer: ''').strip())))




