



'''simple docstring'''


import sys
from collections import defaultdict

class  SCREAMING_SNAKE_CASE :






    """simple docstring"""





    def __init__(  self      :					int ):


       """simple docstring"""







       UpperCamelCase					=  []






    def  A       (  self      :					Optional[Any]  ,						UpperCamelCase__      :					Optional[int] ):


       """simple docstring"""







       return self.node_position[vertex]






    def  A       (  self      :					Any  ,						UpperCamelCase__      :					Any  ,						UpperCamelCase__      :					Union[str, Any] ):


       """simple docstring"""







       UpperCamelCase					=  pos






    def  A       (  self      :					Union[str, Any]  ,						UpperCamelCase__      :					Dict  ,						UpperCamelCase__      :					int  ,						UpperCamelCase__      :					int  ,						UpperCamelCase__      :					List[str] ):


       """simple docstring"""







       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]  ,						UpperCamelCase__ )

             self.top_to_bottom(UpperCamelCase__  ,						UpperCamelCase__  ,						UpperCamelCase__  ,						UpperCamelCase__ )






    def  A       (  self      :					Optional[int]  ,						UpperCamelCase__      :					Union[str, Any]  ,						UpperCamelCase__      :					Any  ,						UpperCamelCase__      :					List[str]  ,						UpperCamelCase__      :					Any ):


       """simple docstring"""







       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]  ,						UpperCamelCase__ )
          else:
             UpperCamelCase					=  val
             UpperCamelCase					=  temp
             self.set_position(UpperCamelCase__  ,						UpperCamelCase__ )
             break
          UpperCamelCase					=  parent
       else:
          UpperCamelCase					=  val
          UpperCamelCase					=  temp
          self.set_position(UpperCamelCase__  ,						0 )






    def  A       (  self      :					List[Any]  ,						UpperCamelCase__      :					Tuple  ,						UpperCamelCase__      :					Dict ):


       """simple docstring"""







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






    def  A       (  self      :					Any  ,						UpperCamelCase__      :					Union[str, Any]  ,						UpperCamelCase__      :					Any ):


       """simple docstring"""







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







def 				__lowerCamelCase				(   A__    )       ->	Union[str, Any]:






   """simple docstring"""
   UpperCamelCase					=  Heap()

   UpperCamelCase					=  [0] * len(A__    )
   UpperCamelCase					=  [-1] * len(A__    )  # 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(A__    )    ):
      distance_tv.append(sys.maxsize    )
      positions.append(A__    )
      heap.node_position.append(A__    )

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

   for _ in range(1    ,						len(A__    )    ):
      UpperCamelCase					=  heap.delete_minimum(A__    ,						A__    )
      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(A__    )]
            ):
               UpperCamelCase					=  distance
               heap.bottom_to_top(
                   A__    ,						heap.get_position(A__    )    ,						A__    ,						A__    )
               UpperCamelCase					=  vertex
   return tree_edges


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






# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ..models.auto import AutoModelForSeqaSeqLM, AutoTokenizer
from .base import PipelineTool






class    __snake_case       (   _SCREAMING_SNAKE_CASE):







    """simple docstring"""



    lowercase    =					'philschmid/bart-large-cnn-samsum'
    lowercase    =					(
        'This is a tool that summarizes an English text. It takes an input `text` containing the text to summarize, '
        'and returns a summary of the text.'
    )
    lowercase    =					'summarizer'
    lowercase    =					AutoTokenizer
    lowercase    =					AutoModelForSeqaSeqLM

    lowercase    =					['text']
    lowercase    =					['text']

    def __lowercase   (   self    :  Dict    ,						lowerCamelCase    :  Dict		)   ->  Any:
      return self.pre_processor(lowerCamelCase    ,						return_tensors="""pt"""    ,						truncation=lowerCamelCase		)

    def __lowercase   (   self    :  Optional[Any]    ,						lowerCamelCase    :  Tuple		)   ->  List[str]:
      return self.model.generate(**lowerCamelCase		)[0]





    def __lowercase   (   self    :  str    ,						lowerCamelCase    :  Dict		)   ->  List[Any]:
      return self.pre_processor.decode(lowerCamelCase    ,						skip_special_tokens=lowerCamelCase    ,						clean_up_tokenization_spaces=lowerCamelCase		)



