



import sys
from collections import defaultdict



class 		_lowercase		:

   def __init__(      self			:       List[Any]							)       ->				List[str]:


    """simple docstring"""






    a						=		[]

   def 		A							(      self			:       Tuple							,   __lowerCAmelCase			:       str							)       ->				Dict:


    """simple docstring"""






    return self.node_position[vertex]

   def 		A							(      self			:       str							,   __lowerCAmelCase			:       Dict							,   __lowerCAmelCase			:       Optional[Any]							)       ->				List[str]:


    """simple docstring"""






    a						=		pos

   def 		A							(      self			:       int							,   __lowerCAmelCase			:       Optional[int]							,   __lowerCAmelCase			:       Dict							,   __lowerCAmelCase			:       List[Any]							,   __lowerCAmelCase			:       Optional[Any]							)       ->				List[Any]:


    """simple docstring"""






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

      a						=		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			:       Optional[int]							,   __lowerCAmelCase			:       str							,   __lowerCAmelCase			:       str							,   __lowerCAmelCase			:       Any							,   __lowerCAmelCase			:       str							)       ->				List[str]:


    """simple docstring"""






    a						=		position[index]

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

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

   def 		A							(      self			:       Optional[int]							,   __lowerCAmelCase			:       int							,   __lowerCAmelCase			:       Tuple							)       ->				int:


    """simple docstring"""






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




   def 		A							(      self			:       Any							,   __lowerCAmelCase			:       Optional[Any]							,   __lowerCAmelCase			:       Any							)       ->				str:


    """simple docstring"""






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


def 	UpperCAmelCase__      (      UpperCAmelCase__ :List[str]					):






 '''simple docstring'''

 a						=		Heap()

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

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

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

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


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


def 	UpperCAmelCase__      (      UpperCAmelCase__ :int					):






 '''simple docstring'''

 a						=		str(UpperCAmelCase__					)
 return len(UpperCAmelCase__					) == 9 and set(UpperCAmelCase__					) == set("123456789"					)


def 	UpperCAmelCase__      (      ):






 '''simple docstring'''

 for base_num in range(99_99 ,					49_99 ,					-1					):
  a						=		10_00_02 * base_num
  if is_9_pandigital(UpperCAmelCase__					):
   return candidate

 for base_num in range(3_33 ,					99 ,					-1					):
  a						=		1_00_20_03 * base_num
  if is_9_pandigital(UpperCAmelCase__					):
   return candidate

 return None


if __name__ == "__main__":
     print(F"""{solution() = }""")

