
'''simple docstring'''
from __future__ import annotations

from typing import Generic, TypeVar

A__   :		Dict 		=TypeVar('T')







class  __A				( Generic[T]			):
 def __init__(   self			:    Any				,   lowerCamelCase			:    T       ):



   """simple docstring"""





   __A		:     List[str]												=		data
   __A		:     Tuple												=		self
   __A		:     Optional[int]												=		0







class  __A				( Generic[T]			):
 def __init__(   self			:    List[str]       ):



   """simple docstring"""





   __A		:     dict[T, DisjointSetTreeNode[T]]												=		{}
 def 		lowercase_(   self			:    Optional[Any]				,   lowerCamelCase			:    T       ):



   """simple docstring"""





   __A		:     Optional[Any]												=		DisjointSetTreeNode(lowerCamelCase       )
 def 		lowercase_(   self			:    Optional[int]				,   lowerCamelCase			:    T       ):



   """simple docstring"""





   __A		:     Union[str, Any]												=		self.map[data]
   if elem_ref != elem_ref.parent:
     __A		:     Optional[Any]												=		self.find_set(elem_ref.parent.data       )
   return elem_ref.parent
 def 		lowercase_(   self			:    List[str]				,   lowerCamelCase			:    DisjointSetTreeNode[T]				,   lowerCamelCase			:    DisjointSetTreeNode[T]       ):



   """simple docstring"""





   if nodea.rank > nodea.rank:
     __A		:     Union[str, Any]												=		nodea
   else:
     __A		:     List[Any]												=		nodea
     if nodea.rank == nodea.rank:
       nodea.rank += 1






 def 		lowercase_(   self			:    List[Any]				,   lowerCamelCase			:    T				,   lowerCamelCase			:    T       ):



   """simple docstring"""





   self.link(self.find_set(lowerCamelCase       )				,   self.find_set(lowerCamelCase       )       )







class  __A				( Generic[T]			):
 def __init__(   self			:    Any       ):



   """simple docstring"""





   __A		:     dict[T, dict[T, int]]												=		{}
 def 		lowercase_(   self			:    Any				,   lowerCamelCase			:    T       ):



   """simple docstring"""





   if node not in self.connections:
     __A		:     Dict												=		{}
 def 		lowercase_(   self			:    List[Any]				,   lowerCamelCase			:    T				,   lowerCamelCase			:    T				,   lowerCamelCase			:    int       ):



   """simple docstring"""





   self.add_node(lowerCamelCase       )
   self.add_node(lowerCamelCase       )
   __A		:     str												=		weight
   __A		:     Optional[int]												=		weight






 def 		lowercase_(   self			:    Dict       ):



   """simple docstring"""





   __A		:     Any												=		[]
   __A		:     int												=		set()
   for start in self.connections:
     for end in self.connections[start]:
       if (start, end) not in seen:
         seen.add((end, start)       )
         edges.append((start, end, self.connections[start][end])       )
   edges.sort(key=lambda lowerCamelCase       : x[2]       )

   # creating the disjoint set
   __A		:     Tuple												=		DisjointSetTree[T]()
   for node in self.connections:
     disjoint_set.make_set(lowerCamelCase       )

   # MST generation
   __A		:     int												=		0
   __A		:     Union[str, Any]												=		0
   __A		:     Any												=		GraphUndirectedWeighted[T]()
   while num_edges < len(self.connections       ) - 1:
     __A		:     Tuple												=		edges[index]
     index += 1
     __A		:     List[Any]												=		disjoint_set.find_set(lowerCamelCase       )
     __A		:     List[str]												=		disjoint_set.find_set(lowerCamelCase       )
     if parent_u != parent_v:
       num_edges += 1
       graph.add_edge(lowerCamelCase				,   lowerCamelCase				,   lowerCamelCase       )
       disjoint_set.union(lowerCamelCase				,   lowerCamelCase       )
   return graph





'''simple docstring'''
A__   :		int 		=8.3_1_4_4_6_2  # Unit - J mol-1 K-1







def        A_     (						__SCREAMING_SNAKE_CASE						:  float			,     __SCREAMING_SNAKE_CASE						:  float			,     __SCREAMING_SNAKE_CASE						:  float )				->       float:





  """simple docstring"""

  if moles < 0 or kelvin < 0 or volume < 0:
    raise ValueError("""Invalid inputs. Enter positive value.""" )
  return moles * kelvin * UNIVERSAL_GAS_CONSTANT / volume







def        A_     (						__SCREAMING_SNAKE_CASE						:  float			,     __SCREAMING_SNAKE_CASE						:  float			,     __SCREAMING_SNAKE_CASE						:  float )				->       float:





  """simple docstring"""

  if moles < 0 or kelvin < 0 or pressure < 0:
    raise ValueError("""Invalid inputs. Enter positive value.""" )
  return moles * kelvin * UNIVERSAL_GAS_CONSTANT / pressure


if __name__ == "__main__":
     from doctest import testmod

     testmod()



