





'''simple docstring'''






import sys
from collections import defaultdict







class 		UpperCAmelCase   :


  """simple docstring"""







  def __init__(				self    :					Dict  )     ->						Optional[int]:
    _UpperCamelCase       			=[]


  def   UpperCamelCase__      (				self    :					Optional[int]							,	UpperCamelCase__    :					Optional[Any]  )     ->						List[Any]:
    return self.node_position[vertex]


  def   UpperCamelCase__      (				self    :					List[Any]							,	UpperCamelCase__    :					int							,	UpperCamelCase__    :					Any  )     ->						Optional[int]:
    _UpperCamelCase       			=pos


  def   UpperCamelCase__      (				self    :					Tuple							,	UpperCamelCase__    :					Dict							,	UpperCamelCase__    :					Dict							,	UpperCamelCase__    :					List[Any]							,	UpperCamelCase__    :					Optional[Any]  )     ->						int:
    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			,     _UpperCamelCase       			=heap[smallest_child], positions[smallest_child]
        _UpperCamelCase			,     _UpperCamelCase       			=(
            heap[start],
            positions[start],
        )
        _UpperCamelCase			,     _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   UpperCamelCase__      (				self    :					Optional[Any]							,	UpperCamelCase__    :					Tuple							,	UpperCamelCase__    :					List[str]							,	UpperCamelCase__    :					Optional[Any]							,	UpperCamelCase__    :					Dict  )     ->						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]							,	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   UpperCamelCase__      (				self    :					Optional[Any]							,	UpperCamelCase__    :					str							,	UpperCamelCase__    :					Dict  )     ->						Optional[int]:
    _UpperCamelCase       			=len(UpperCamelCase__  ) // 2 - 1
    for i in range(UpperCamelCase__							,	-1							,	-1  ):
      self.top_to_bottom(UpperCamelCase__							,	UpperCamelCase__							,	len(UpperCamelCase__  )							,	UpperCamelCase__  )




  def   UpperCamelCase__      (				self    :					Dict							,	UpperCamelCase__    :					Tuple							,	UpperCamelCase__    :					List[str]  )     ->						Any:
    _UpperCamelCase       			=positions[0]
    _UpperCamelCase       			=sys.maxsize
    self.top_to_bottom(UpperCamelCase__							,	0							,	len(UpperCamelCase__  )							,	UpperCamelCase__  )
    return temp




def 					_a   (__SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  _UpperCamelCase       			=Heap()

  _UpperCamelCase       			=[0] * len(__SCREAMING_SNAKE_CASE   )
  _UpperCamelCase       			=[-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
  _UpperCamelCase       			=[]  # Heap of Distance of vertices from their neighboring vertex
  _UpperCamelCase       			=[]

  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   )

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

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


if __name__ == "__main__":  # pragma: no cover
      # < --------- Prims Algorithm --------- >
      __lowerCamelCase						: List[str]		=   int(input('Enter number of edges: ').strip())
      __lowerCamelCase						: str		=   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'''






import importlib.util
import os
import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import (
    is_accelerate_available,
    is_flax_available,
    is_safetensors_available,
    is_tf_available,
    is_torch_available,
)
from . import BaseTransformersCLICommand


def 					_a   (__SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  return EnvironmentCommand()


def 					_a   (__SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  return EnvironmentCommand(args.accelerate_config_file   )







class 		UpperCAmelCase   (				lowercase_):


  """simple docstring"""







  @staticmethod
  def   UpperCamelCase__      (				UpperCamelCase__    :					ArgumentParser  )     ->						Union[str, Any]:
    _UpperCamelCase       			=parser.add_parser('''env'''  )
    download_parser.set_defaults(func=UpperCamelCase__  )
    download_parser.add_argument(
        '''--accelerate-config_file'''							,	default=UpperCamelCase__							,	help='''The accelerate config file to use for the default values in the launching script.'''							,	)
    download_parser.set_defaults(func=UpperCamelCase__  )


  def __init__(				self    :					Tuple							,	UpperCamelCase__    :					Dict							,	*UpperCamelCase__    :					str  )     ->						None:
    _UpperCamelCase       			=accelerate_config_file


  def   UpperCamelCase__      (				self    :					str  )     ->						int:
    _UpperCamelCase       			='''not installed'''
    if is_safetensors_available():
      import safetensors

      _UpperCamelCase       			=safetensors.__version__
    elif importlib.util.find_spec('''safetensors'''  ) is not None:
      import safetensors

      _UpperCamelCase       			=F'''{safetensors.__version__} but is ignored because of PyTorch version too old.'''

    _UpperCamelCase       			='''not installed'''
    _UpperCamelCase       			=_UpperCamelCase       			='''not found'''
    if is_accelerate_available():
      import accelerate
      from accelerate.commands.config import default_config_file, load_config_from_file

      _UpperCamelCase       			=accelerate.__version__
      # Get the default from the config file.
      if self._accelerate_config_file is not None or os.path.isfile(UpperCamelCase__  ):
        _UpperCamelCase       			=load_config_from_file(self._accelerate_config_file  ).to_dict()

      _UpperCamelCase       			=(
          '''\n'''.join([F'''\t- {prop}: {val}''' for prop, val in accelerate_config.items()]  )
          if isinstance(UpperCamelCase__							,	UpperCamelCase__  )
          else F'''\t{accelerate_config}'''
      )

    _UpperCamelCase       			='''not installed'''
    _UpperCamelCase       			='''NA'''
    if is_torch_available():
      import torch

      _UpperCamelCase       			=torch.__version__
      _UpperCamelCase       			=torch.cuda.is_available()

    _UpperCamelCase       			='''not installed'''
    _UpperCamelCase       			='''NA'''
    if is_tf_available():
      import tensorflow as tf

      _UpperCamelCase       			=tf.__version__
      try:
        # deprecated in v2.1
        _UpperCamelCase       			=tf.test.is_gpu_available()
      except AttributeError:
        # returns list of devices, convert to bool
        _UpperCamelCase       			=bool(tf.config.list_physical_devices('''GPU'''  )  )

    _UpperCamelCase       			='''not installed'''
    _UpperCamelCase       			='''not installed'''
    _UpperCamelCase       			='''not installed'''
    _UpperCamelCase       			='''NA'''
    if is_flax_available():
      import flax
      import jax
      import jaxlib

      _UpperCamelCase       			=flax.__version__
      _UpperCamelCase       			=jax.__version__
      _UpperCamelCase       			=jaxlib.__version__
      _UpperCamelCase       			=jax.lib.xla_bridge.get_backend().platform

    _UpperCamelCase       			={
        '''`transformers` version''': version,
        '''Platform''': platform.platform(),
        '''Python version''': platform.python_version(),
        '''Huggingface_hub version''': huggingface_hub.__version__,
        '''Safetensors version''': F'''{safetensors_version}''',
        '''Accelerate version''': F'''{accelerate_version}''',
        '''Accelerate config''': F'''{accelerate_config_str}''',
        '''PyTorch version (GPU?)''': F'''{pt_version} ({pt_cuda_available})''',
        '''Tensorflow version (GPU?)''': F'''{tf_version} ({tf_cuda_available})''',
        '''Flax version (CPU?/GPU?/TPU?)''': F'''{flax_version} ({jax_backend})''',
        '''Jax version''': F'''{jax_version}''',
        '''JaxLib version''': F'''{jaxlib_version}''',
        '''Using GPU in script?''': '''<fill in>''',
        '''Using distributed or parallel set-up in script?''': '''<fill in>''',
    }

    print('''\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n'''  )
    print(self.format_dict(UpperCamelCase__  )  )

    return info




  @staticmethod
  def   UpperCamelCase__      (				UpperCamelCase__    :					Optional[Any]  )     ->						Dict:
    return "\n".join([F'''- {prop}: {val}''' for prop, val in d.items()]  ) + "\n"






