






'''simple docstring'''

from __future__ import annotations

from typing import Any






class        a_		:

  def __init__(   self    ,	_SCREAMING_SNAKE_CASE   )						->   None:



        """simple docstring"""






        UpperCamelCase       						=      num_of_nodes
        UpperCamelCase       						=      []
        UpperCamelCase       						=      {}

  def 						A__		(   self    ,	_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE   )						->   None:



        """simple docstring"""






        self.m_edges.append([u_node, v_node, weight]   )

  def 						A__		(   self    ,	_SCREAMING_SNAKE_CASE   )						->   int:



        """simple docstring"""






        if self.m_component[u_node] == u_node:
              return u_node
        return self.find_component(self.m_component[u_node]   )

  def 						A__		(   self    ,	_SCREAMING_SNAKE_CASE   )						->   None:



        """simple docstring"""






        if self.m_component[u_node] != u_node:
              for k in self.m_component:
                    UpperCamelCase       						=      self.find_component(_SCREAMING_SNAKE_CASE   )

  def 						A__		(   self    ,	_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE   )						->   None:



        """simple docstring"""






        if component_size[u_node] <= component_size[v_node]:
              UpperCamelCase       						=      v_node
              component_size[v_node] += component_size[u_node]
              self.set_component(_SCREAMING_SNAKE_CASE   )

        elif component_size[u_node] >= component_size[v_node]:
              UpperCamelCase       						=      self.find_component(_SCREAMING_SNAKE_CASE   )
              component_size[u_node] += component_size[v_node]
              self.set_component(_SCREAMING_SNAKE_CASE   )


  def 						A__		(   self   )						->   None:



        """simple docstring"""






        UpperCamelCase       						=      []
        UpperCamelCase       						=      0

        UpperCamelCase       						=      [-1] * self.m_num_of_nodes

        # A list of components (initialized to all of the nodes)
        for node in range(self.m_num_of_nodes   ):
              self.m_component.update({node: node}   )
              component_size.append(1   )

        UpperCamelCase       						=      self.m_num_of_nodes

        while num_of_components > 1:
              for edge in self.m_edges:
                    UpperCamelCase						,UpperCamelCase						,UpperCamelCase       						=      edge

                    UpperCamelCase       						=      self.m_component[u]
                    UpperCamelCase       						=      self.m_component[v]

                    if u_component != v_component:

                          for component in (u_component, v_component):
                                if (
                                    minimum_weight_edge[component] == -1
                                    or minimum_weight_edge[component][2] > w
                                ):
                                      UpperCamelCase       						=      [u, v, w]

              for edge in minimum_weight_edge:
                    if isinstance(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE   ):
                          UpperCamelCase						,UpperCamelCase						,UpperCamelCase       						=      edge

                          UpperCamelCase       						=      self.m_component[u]
                          UpperCamelCase       						=      self.m_component[v]

                          if u_component != v_component:
                                mst_weight += w
                                self.union(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE   )
                                print(F"Added edge [{u} - {v}]\nAdded weight: {w}\n"   )
                                num_of_components -= 1

              UpperCamelCase       						=      [-1] * self.m_num_of_nodes
        print(F"The total weight of the minimal spanning tree is: {mst_weight}"   )







def 					lowercase__				(   )->				None:
      pass


if __name__ == "__main__":
     import doctest

     doctest.testmod()








'''simple docstring'''

def 					lowercase__				(   __UpperCamelCase	,		__UpperCamelCase					)->				str:
      if not isinstance(__UpperCamelCase	,		__UpperCamelCase					):
            raise ValueError("""iterations must be defined as integers"""					)
      if not isinstance(__UpperCamelCase	,		__UpperCamelCase					) or not number >= 1:
            raise ValueError(
                """starting number must be
                         and integer and be more than 0"""					)
      if not iterations >= 1:
            raise ValueError("""Iterations must be done more than 0 times to play FizzBuzz"""					)

      UpperCamelCase       						=      """"""
      while number <= iterations:
            if number % 3 == 0:
                  out += "Fizz"
            if number % 5 == 0:
                  out += "Buzz"
            if 0 not in (number % 3, number % 5):
                  out += str(__UpperCamelCase					)

            # print(out)
            number += 1
            out += " "
      return out


if __name__ == "__main__":
     import doctest

     doctest.testmod()
