import sys
from collections import defaultdict




class 			__magic_name__	:





   """simple docstring"""




   def __init__(						self       :	List[Any]				):



    """simple docstring"""



    _UpperCamelCase:  Dict    						=			[]



   def 	lowerCAmelCase    (						self       :	List[Any]		,	_lowercase       :	List[str]				):



    """simple docstring"""



    return self.node_position[vertex]



   def 	lowerCAmelCase    (						self       :	Optional[Any]		,	_lowercase       :	Optional[int]		,	_lowercase       :	Optional[int]				):



    """simple docstring"""



    _UpperCamelCase:  List[Any]    						=			pos



   def 	lowerCAmelCase    (						self       :	Union[str, Any]		,	_lowercase       :	Dict		,	_lowercase       :	Union[str, Any]		,	_lowercase       :	Optional[Any]		,	_lowercase       :	List[str]				):



    """simple docstring"""



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

      _UpperCamelCase:  List[str]    						=			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 	lowerCAmelCase    (						self       :	List[str]		,	_lowercase       :	List[Any]		,	_lowercase       :	Tuple		,	_lowercase       :	int		,	_lowercase       :	List[str]				):



    """simple docstring"""



    _UpperCamelCase:  Dict    						=			position[index]

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

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



   def 	lowerCAmelCase    (						self       :	str		,	_lowercase       :	List[Any]		,	_lowercase       :	Tuple				):



    """simple docstring"""



    _UpperCamelCase:  List[str]    						=			len(_lowercase				) // 2 - 1
    for i in range(_lowercase		,	-1		,	-1				):
     self.top_to_bottom(_lowercase		,	_lowercase		,	len(_lowercase				)		,	_lowercase				)



   def 	lowerCAmelCase    (						self       :	Tuple		,	_lowercase       :	List[str]		,	_lowercase       :	Optional[int]				):



    """simple docstring"""



    _UpperCamelCase:  int    						=			positions[0]
    _UpperCamelCase:  Tuple    						=			sys.maxsize
    self.top_to_bottom(_lowercase		,	0		,	len(_lowercase				)		,	_lowercase				)
    return temp




def    lowerCAmelCase_  (		lowercase:				List[str]		)     ->					Optional[int]:







 '''simple docstring'''
 _UpperCamelCase:  Optional[Any]    						=			Heap()

 _UpperCamelCase:  int    						=			[0] * len(lowercase		)
 _UpperCamelCase:  Dict    						=			[-1] * len(lowercase		)  # 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[Any]    						=			[]

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

 _UpperCamelCase:  List[Any]    						=			[]
 _UpperCamelCase:  Union[str, Any]    						=			1
 _UpperCamelCase:  List[str]    						=			sys.maxsize
 for neighbor, distance in adjacency_list[0]:
  _UpperCamelCase:  List[Any]    						=			0
  _UpperCamelCase:  Tuple    						=			distance
 heap.heapify(lowercase	,       lowercase		)

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


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




def    lowerCAmelCase_  (		)     ->					int:







 '''simple docstring'''
 if torch.cuda.is_available():
  _UpperCamelCase:  Any    						=			torch.cuda.device_count()
 else:
  _UpperCamelCase:  Union[str, Any]    						=			0
 print(F"""Successfully ran on {num_gpus} GPUs"""		)


if __name__ == "__main__":
  main()