'''simple docstring'''





from collections.abc import Callable

import numpy as np
def 						__A							(     UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase					)     ->			np.ndarray:




						'''simple docstring'''
						_UpperCamelCase			:			Any   			=						int(np.ceil((x_end - xa) / step_size					)					)
						_UpperCamelCase			:			str   			=						np.zeros((n + 1,)					)
						_UpperCamelCase			:			Any   			=						ya
						_UpperCamelCase			:			List[str]   			=						xa

						for k in range(UpperCAmelCase					):
												_UpperCamelCase			:			Union[str, Any]   			=						y[k] + step_size * ode_func(UpperCAmelCase     ,y[k]					)
												x += step_size

						return y


if __name__ == "__main__":
			import doctest

			doctest.testmod()



'''simple docstring'''





import sys
from collections import defaultdict




class 		SCREAMING_SNAKE_CASE     :







				'''simple docstring'''





				def __init__(						self					:						Tuple					)							->Optional[int]:


										'''simple docstring'''




										_UpperCamelCase			:			List[Any]   			=						[]





				def  snake_case__				(						self					:						Any       ,		lowercase__					:						Any					)							->Optional[int]:


										'''simple docstring'''




										return self.node_position[vertex]





				def  snake_case__				(						self					:						str       ,		lowercase__					:						Optional[int]       ,		lowercase__					:						Optional[int]					)							->int:


										'''simple docstring'''




										_UpperCamelCase			:			List[Any]   			=						pos





				def  snake_case__				(						self					:						Union[str, Any]       ,		lowercase__					:						Optional[int]       ,		lowercase__					:						List[Any]       ,		lowercase__					:						Dict       ,		lowercase__					:						Dict					)							->Dict:


										'''simple docstring'''




										if start > size // 2 - 1:
																return
										else:
																if 2 * start + 2 >= size:
																						_UpperCamelCase			:			Tuple   			=						2 * start + 1
																else:
																						if heap[2 * start + 1] < heap[2 * start + 2]:
																												_UpperCamelCase			:			str   			=						2 * start + 1
																						else:
																												_UpperCamelCase			:			List[Any]   			=						2 * start + 2
																if heap[smallest_child] < heap[start]:
																						_UpperCamelCase			,       _UpperCamelCase			:			Dict   			=						heap[smallest_child], positions[smallest_child]
																						_UpperCamelCase			,       _UpperCamelCase			:			int   			=						(
																						    heap[start],
																						    positions[start],
																						)
																						_UpperCamelCase			,       _UpperCamelCase			:			Tuple   			=						temp, tempa

																						_UpperCamelCase			:			Optional[Any]   			=						self.get_position(positions[smallest_child]					)
																						self.set_position(
																						    positions[smallest_child]       ,		self.get_position(positions[start]					)					)
																						self.set_position(positions[start]       ,		lowercase__					)

																						self.top_to_bottom(lowercase__       ,		lowercase__       ,		lowercase__       ,		lowercase__					)





				def  snake_case__				(						self					:						Optional[int]       ,		lowercase__					:						List[Any]       ,		lowercase__					:						str       ,		lowercase__					:						List[Any]       ,		lowercase__					:						List[str]					)							->str:


										'''simple docstring'''




										_UpperCamelCase			:			str   			=						position[index]

										while index != 0:
																_UpperCamelCase			:			List[str]   			=						int((index - 2) / 2					) if index % 2 == 0 else int((index - 1) / 2					)

																if val < heap[parent]:
																						_UpperCamelCase			:			Tuple   			=						heap[parent]
																						_UpperCamelCase			:			List[Any]   			=						position[parent]
																						self.set_position(position[parent]       ,		lowercase__					)
																else:
																						_UpperCamelCase			:			Optional[int]   			=						val
																						_UpperCamelCase			:			Tuple   			=						temp
																						self.set_position(lowercase__       ,		lowercase__					)
																						break
																_UpperCamelCase			:			Any   			=						parent
										else:
																_UpperCamelCase			:			Optional[Any]   			=						val
																_UpperCamelCase			:			Union[str, Any]   			=						temp
																self.set_position(lowercase__       ,		0					)





				def  snake_case__				(						self					:						Tuple       ,		lowercase__					:						Optional[Any]       ,		lowercase__					:						Tuple					)							->Optional[int]:


										'''simple docstring'''




										_UpperCamelCase			:			Optional[int]   			=						len(lowercase__					) // 2 - 1
										for i in range(lowercase__       ,		-1       ,		-1					):
																self.top_to_bottom(lowercase__       ,		lowercase__       ,		len(lowercase__					)       ,		lowercase__					)







				def  snake_case__				(						self					:						Dict       ,		lowercase__					:						Union[str, Any]       ,		lowercase__					:						Union[str, Any]					)							->Any:


										'''simple docstring'''




										_UpperCamelCase			:			List[Any]   			=						positions[0]
										_UpperCamelCase			:			Tuple   			=						sys.maxsize
										self.top_to_bottom(lowercase__       ,		0       ,		len(lowercase__					)       ,		lowercase__					)
										return temp





def 						__A							(     UpperCAmelCase					)     ->			Any:




						'''simple docstring'''
						_UpperCamelCase			:			Union[str, Any]   			=						Heap()

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

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

						_UpperCamelCase			:			Optional[Any]   			=						[]
						_UpperCamelCase			:			Union[str, Any]   			=						1
						_UpperCamelCase			:			int   			=						sys.maxsize
						for neighbor, distance in adjacency_list[0]:
												_UpperCamelCase			:			Union[str, Any]   			=						0
												_UpperCamelCase			:			int   			=						distance
						heap.heapify(UpperCAmelCase     ,UpperCAmelCase					)

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


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


