





from __future__ import annotations

from typing import Any



class       A__     :





      def __init__(				self ,							A_     ):
       '''simple docstring'''




       UpperCamelCase			:      str 			=     num_of_nodes
       UpperCamelCase			:      list[list[int]] 			=     []
       UpperCamelCase			:      dict[int, int] 			=     {}





      def  __UpperCamelCase(				self ,							A_ ,							A_ ,							A_     ):
       '''simple docstring'''




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





      def  __UpperCamelCase(				self ,							A_     ):
       '''simple docstring'''




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





      def  __UpperCamelCase(				self ,							A_     ):
       '''simple docstring'''




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





      def  __UpperCamelCase(				self ,							A_ ,							A_ ,							A_     ):
       '''simple docstring'''




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

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





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       UpperCamelCase			:      Tuple 			=     []
       UpperCamelCase			:      Tuple 			=     0

       UpperCamelCase			:      list[Any] 			=     [-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			:      List[str] 			=     self.m_num_of_nodes

       while num_of_components > 1:
        for edge in self.m_edges:
         UpperCamelCase			,					UpperCamelCase			,					UpperCamelCase			:      List[str] 			=     edge

         UpperCamelCase			:      List[str] 			=     self.m_component[u]
         UpperCamelCase			:      Optional[Any] 			=     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			:      List[str] 			=     [u, v, w]

        for edge in minimum_weight_edge:
         if isinstance(A_ ,							A_     ):
          UpperCamelCase			,					UpperCamelCase			,					UpperCamelCase			:      Optional[int] 			=     edge

          UpperCamelCase			:      Dict 			=     self.m_component[u]
          UpperCamelCase			:      Optional[Any] 			=     self.m_component[v]

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

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



def 	A_       (  )		->				None:
 pass


if __name__ == "__main__":
    import doctest

    doctest.testmod()







from __future__ import annotations



def 	A_       (  _lowerCAmelCase  )		->				list[int]:
 UpperCamelCase			:      Optional[Any] 			=     [True] * limit
 UpperCamelCase			:      Optional[Any] 			=     False
 UpperCamelCase			:      List[str] 			=     False
 UpperCamelCase			:      Tuple 			=     True

 for i in range(3							,     int(limit**0.5 + 1  )							,     2  ):
  UpperCamelCase			:      Optional[Any] 			=     i * 2
  while index < limit:
   UpperCamelCase			:      int 			=     False
   UpperCamelCase			:      Optional[int] 			=     index + i

 UpperCamelCase			:      Any 			=     [2]

 for i in range(3							,     _lowerCAmelCase							,     2  ):
  if is_prime[i]:
   primes.append(_lowerCAmelCase  )

 return primes



def 	A_       (  _lowerCAmelCase = 100_0000  )		->				int:
 UpperCamelCase			:      Union[str, Any] 			=     prime_sieve(_lowerCAmelCase  )
 UpperCamelCase			:      List[str] 			=     0
 UpperCamelCase			:      Union[str, Any] 			=     0

 for i in range(len(_lowerCAmelCase  )  ):
  for j in range(i + length							,     len(_lowerCAmelCase  )  ):
   UpperCamelCase			:      Dict 			=     sum(primes[i:j]  )
   if sol >= ceiling:
    break

   if sol in primes:
    UpperCamelCase			:      int 			=     j - i
    UpperCamelCase			:      Dict 			=     sol

 return largest


if __name__ == "__main__":
    print(f"""{solution() = }""")
