'''simple docstring'''





import sys
from collections import defaultdict




class        __A      :



    def __init__(self    :    Optional[Any] ):
         UpperCAmelCase_           =   []



    def 					_lowercase						(self    :    Union[str, Any]   ,			__a    :    List[Any] ):
         return self.node_position[vertex]



    def 					_lowercase						(self    :    Union[str, Any]   ,			__a    :    Optional[Any]   ,			__a    :    Dict ):
         UpperCAmelCase_           =   pos



    def 					_lowercase						(self    :    str   ,			__a    :    str   ,			__a    :    Dict   ,			__a    :    Optional[Any]   ,			__a    :    str ):

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

                   UpperCAmelCase_           =   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 					_lowercase						(self    :    Any   ,			__a    :    Dict   ,			__a    :    Union[str, Any]   ,			__a    :    Optional[Any]   ,			__a    :    List[str] ):
         UpperCAmelCase_           =   position[index]

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

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



    def 					_lowercase						(self    :    List[str]   ,			__a    :    Optional[int]   ,			__a    :    int ):
         UpperCAmelCase_           =   len(a_ ) // 2 - 1
         for i in range(a_   ,			-1   ,			-1 ):
              self.top_to_bottom(a_   ,			a_   ,			len(a_ )   ,			a_ )






    def 					_lowercase						(self    :    List[str]   ,			__a    :    Dict   ,			__a    :    str ):
         UpperCAmelCase_           =   positions[0]
         UpperCAmelCase_           =   sys.maxsize
         self.top_to_bottom(a_   ,			0   ,			len(a_ )   ,			a_ )
         return temp





def 	lowerCAmelCase_				(					snake_case_       : Union[str, Any]			)    ->      Union[str, Any]:


     '''simple docstring'''




     UpperCAmelCase_           =   Heap()

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

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

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

     for _ in range(1					,    len(_snake_case			)			):
          UpperCAmelCase_           =   heap.delete_minimum(_snake_case					,    _snake_case			)
          if visited[vertex] == 0:
               tree_edges.append((nbr_tv[vertex], vertex)			)
               UpperCAmelCase_           =   1
               for neighbor, distance in adjacency_list[vertex]:
                    if (
                        visited[neighbor] == 0
                        and distance < distance_tv[heap.get_position(_snake_case			)]
                    ):
                         UpperCAmelCase_           =   distance
                         heap.bottom_to_top(
                             _snake_case					,    heap.get_position(_snake_case			)					,    _snake_case					,    _snake_case			)
                         UpperCAmelCase_           =   vertex
     return tree_edges


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






def 		lowercase							(     _snake_case						:      int     )     ->bool:
	"""simple docstring"""





	if 1 < number < 4:
		# 2 and 3 are primes
		return True
	elif number < 2 or number % 2 == 0 or number % 3 == 0:
		# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
		return False

	# All primes number are in format of 6k +/- 1
	for i in range(5     ,   int(math.sqrt(_snake_case     ) + 1     )     ,   6     ):
		if number % i == 0 or number % (i + 2) == 0:
			return False
	return True






def 		lowercase							(     _snake_case						:      float = 0.1     )     ->int:
	"""simple docstring"""





	__snake_case	:						Tuple						=				3
	__snake_case	:						Any						=				3

	while primes / (2 * j - 1) >= ratio:
		for i in range(j * j + j + 1     ,   (j + 2) * (j + 2)     ,   j + 1     ):
			primes += is_prime(_snake_case     )
		j += 2
	return j


if __name__ == "__main__":
			import doctest

			doctest.testmod()





