


"""simple docstring"""







import sys
from collections import defaultdict


class       SCREAMING_SNAKE_CASE__				:
       """simple docstring"""


       def __init__(						self						):






         """simple docstring"""





         lowerCAmelCase     :     Tuple								=							[]

       def        lowercase__							(						self		,     snake_case__						):






         """simple docstring"""





         return self.node_position[vertex]

       def        lowercase__							(						self		,     snake_case__		,     snake_case__						):






         """simple docstring"""





         lowerCAmelCase     :     Tuple								=							pos

       def        lowercase__							(						self		,     snake_case__		,     snake_case__		,     snake_case__		,     snake_case__						):






         """simple docstring"""





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

             lowerCAmelCase     :     Dict								=							self.get_position(positions[smallest_child]						)
             self.set_position(
                 positions[smallest_child]		,     self.get_position(positions[start]						)						)
             self.set_position(positions[start]		,     snake_case__						)

             self.top_to_bottom(snake_case__		,     snake_case__		,     snake_case__		,     snake_case__						)

       def        lowercase__							(						self		,     snake_case__		,     snake_case__		,     snake_case__		,     snake_case__						):






         """simple docstring"""





         lowerCAmelCase     :     Tuple								=							position[index]

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

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

       def        lowercase__							(						self		,     snake_case__		,     snake_case__						):






         """simple docstring"""





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







       def        lowercase__							(						self		,     snake_case__		,     snake_case__						):






         """simple docstring"""





         lowerCAmelCase     :     Any								=							positions[0]
         lowerCAmelCase     :     List[Any]								=							sys.maxsize
         self.top_to_bottom(snake_case__		,     0		,     len(snake_case__						)		,     snake_case__						)
         return temp

def 					a__			(				SCREAMING_SNAKE_CASE    :    Union[str, Any]				):


  '''simple docstring'''







  lowerCAmelCase     :     List[Any]								=							Heap()

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

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

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

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


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




from pathlib import PurePosixPath
from typing import Optional

import fsspec
from fsspec import AbstractFileSystem
from huggingface_hub.hf_api import DatasetInfo

from ..utils.file_utils import get_authentication_headers_for_url
from ..utils.hub import hf_hub_url
class 						__A							( SCREAMING_SNAKE_CASE_		):
     _UpperCamelCase							:			Union[str, Any]							=		""
     _UpperCamelCase							:			str							=		"hf-legacy"  # "hf://"" is reserved for hffs






     def __init__(		self				,     a__ = None				,     a__ = None				,     **a__				,     ):
       super().__init__(self				,     **a__  )
       _lowerCAmelCase						:       Any  			=     repo_info
       _lowerCAmelCase						:       Optional[Any]  			=     token
       _lowerCAmelCase						:       Optional[int]  			=     None






     def     __A  (		self  ):
       if self.dir_cache is None:
         _lowerCAmelCase						:       Optional[Any]  			=     {}
         for hf_file in self.repo_info.siblings:
           # TODO(QL): add sizes
           _lowerCAmelCase						:       Any  			=     {
               """name""": hf_file.rfilename,
               """size""": None,
               """type""": """file""",
           }
           self.dir_cache.update(
               {
                   str(a__  ): {"""name""": str(a__  ), """size""": None, """type""": """directory"""}
                   for d in list(PurePosixPath(hf_file.rfilename  ).parents  )[:-1]
               }  )






     def     __A  (		self				,     a__				,     a__ = "rb"				,     **a__				,     ):
       if not isinstance(self.repo_info				,     a__  ):
         raise NotImplementedError(F"Open is only implemented for dataset repositories, but got {self.repo_info}"  )
       _lowerCAmelCase						:       Tuple  			=     hf_hub_url(self.repo_info.id				,     a__				,     revision=self.repo_info.sha  )
       return fsspec.open(
           a__				,     mode=a__				,     headers=get_authentication_headers_for_url(a__				,     use_auth_token=self.token  )				,     client_kwargs={"""trust_env""": True}				,     ).open()






     def     __A  (		self				,     a__				,     **a__  ):
       self._get_dirs()
       _lowerCAmelCase						:       Union[str, Any]  			=     self._strip_protocol(a__  )
       if path in self.dir_cache:
         return self.dir_cache[path]
       else:
         raise FileNotFoundError(a__  )






     def     __A  (		self				,     a__				,     a__=False				,     **a__  ):
       self._get_dirs()
       _lowerCAmelCase						:       Any  			=     PurePosixPath(path.strip("""/"""  )  )
       _lowerCAmelCase						:       List[str]  			=     {}
       for p, f in self.dir_cache.items():
         _lowerCAmelCase						:       Any  			=     PurePosixPath(p.strip("""/"""  )  )
         _lowerCAmelCase						:       Optional[int]  			=     p.parent
         if root == path:
           _lowerCAmelCase						:       Dict  			=     f
       _lowerCAmelCase						:       Union[str, Any]  			=     list(paths.values()  )
       if detail:
         return out
       else:
         return sorted(f["""name"""] for f in out  )




