


import sys
from collections import defaultdict


class 					lowerCAmelCase_ :




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






									"""simple docstring"""






									a__ :Optional[Any]						  =    []




						def  _snake_case					(	self						:   Optional[Any]   ,     __A						:   List[Any]						)      ->List[str]:






									"""simple docstring"""






									return self.node_position[vertex]




						def  _snake_case					(	self						:   Optional[Any]   ,     __A						:   str   ,     __A						:   Any						)      ->Dict:






									"""simple docstring"""






									a__ :Dict						  =    pos




						def  _snake_case					(	self						:   str   ,     __A						:   Union[str, Any]   ,     __A						:   Union[str, Any]   ,     __A						:   Optional[Any]   ,     __A						:   Optional[int]						)      ->List[Any]:






									"""simple docstring"""






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

															a__ :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  _snake_case					(	self						:   List[str]   ,     __A						:   Any   ,     __A						:   List[str]   ,     __A						:   Any   ,     __A						:   str						)      ->Optional[Any]:






									"""simple docstring"""






									a__ :Optional[Any]						  =    position[index]

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

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




						def  _snake_case					(	self						:   Tuple   ,     __A						:   int   ,     __A						:   int						)      ->Union[str, Any]:






									"""simple docstring"""






									a__ :Tuple						  =    len(__A						) // 2 - 1
									for i in range(__A   ,     -1   ,     -1						):
												self.top_to_bottom(__A   ,     __A   ,     len(__A						)   ,     __A						)






						def  _snake_case					(	self						:   List[Any]   ,     __A						:   List[Any]   ,     __A						:   int						)      ->Optional[Any]:






									"""simple docstring"""






									a__ :Any						  =    positions[0]
									a__ :str						  =    sys.maxsize
									self.top_to_bottom(__A   ,     0   ,     len(__A						)   ,     __A						)
									return temp






def 				lowerCamelCase__	(      a	:   Any				)    ->	Union[str, Any]:





			"""simple docstring"""
			a__ :Tuple						  =    Heap()

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

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

			a__ :Tuple						  =    []
			a__ :Any						  =    1
			a__ :int						  =    sys.maxsize
			for neighbor, distance in adjacency_list[0]:
						a__ :int						  =    0
						a__ :List[str]						  =    distance
			heap.heapify(a	,  a				)

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


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






def 				lowerCamelCase__	(      a	:   int	,  a	:   int				)    ->	Any:





			"""simple docstring"""
			# "extended trapezoidal rule"
			# int(f) = dx/2 * (f1 + 2f2 + ... + fn)
			a__ :Optional[int]						  =    (boundary[1] - boundary[0]) / steps
			a__ :str						  =    boundary[0]
			a__ :Optional[int]						  =    boundary[1]
			a__ :str						  =    make_points(a	,  a	,  a				)
			a__ :Any						  =    0.0
			y += (h / 2.0) * f(a				)
			for i in x_i:
						# print(i)
						y += h * f(a				)
			y += (h / 2.0) * f(a				)
			return y


def 				lowerCamelCase__	(      a	:   Any	,  a	:   str	,  a	:   Dict				)    ->	int:





			"""simple docstring"""
			a__ :Union[str, Any]						  =    a + h
			while x < (b - h):
						yield x
						a__ :str						  =    x + h


def 				lowerCamelCase__	(      a	:   Optional[int]				)    ->	List[Any]:  # enter your function here





			"""simple docstring"""
			a__ :Tuple						  =    (x - 0) * (x - 0)
			return y


def 				lowerCamelCase__	(      )    ->	List[str]:





			"""simple docstring"""
			a__ :Optional[Any]						  =    0.0  # Lower bound of integration
			a__ :Optional[Any]						  =    1.0  # Upper bound of integration
			a__ :List[str]						  =    1_0.0  # define number of steps or resolution
			a__ :int						  =    [a, b]  # define boundary of integration
			a__ :str						  =    method_a(a	,  a				)
			print(F'''y = {y}'''				)


if __name__ == "__main__":
		main()


