





'''simple docstring'''

from __future__ import annotations

from collections import Counter
from random import random







class __a :





   def __init__(					self				:			Optional[Any]    ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE      							=       {}





   def      UpperCAmelCase__     (					self				:			Union[str, Any]				,lowerCamelCase				:			str    ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE      							=       {}





   def      UpperCAmelCase__     (					self				:			Tuple				,lowerCamelCase				:			str				,lowerCamelCase				:			str				,lowerCamelCase				:			float    ):

      '''simple docstring'''

      if nodea not in self.connections:
         self.add_node(lowerCamelCase    )
      if nodea not in self.connections:
         self.add_node(lowerCamelCase    )
      __SCREAMING_SNAKE_CASE      							=       probability





   def      UpperCAmelCase__     (					self				:			Dict    ):

      '''simple docstring'''

      return list(self.connections    )





   def      UpperCAmelCase__     (					self				:			int				,lowerCamelCase				:			str    ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE      							=       0
      __SCREAMING_SNAKE_CASE      							=       random()

      for dest in self.connections[node]:
         current_probability += self.connections[node][dest]
         if current_probability > random_value:
            return dest
      return ""





def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase							,	__UpperCAmelCase      )						->					dict[str, int]:

   '''simple docstring'''







   __SCREAMING_SNAKE_CASE      							=       MarkovChainGraphUndirectedUnweighted()

   for nodea, nodea, probability in transitions:
      graph.add_transition_probability(__UpperCAmelCase							,	__UpperCAmelCase							,	__UpperCAmelCase      )

   __SCREAMING_SNAKE_CASE      							=       Counter(graph.get_nodes()      )
   __SCREAMING_SNAKE_CASE      							=       start

   for _ in range(__UpperCAmelCase      ):
      __SCREAMING_SNAKE_CASE      							=       graph.transition(__UpperCAmelCase      )
      visited[node] += 1

   return visited


if __name__ == "__main__":
    import doctest

    doctest.testmod()












'''simple docstring'''

def 						__magic_name__       (							__UpperCAmelCase      )						->					bool:

   '''simple docstring'''







   if num < 0:
      return False

   __SCREAMING_SNAKE_CASE      							=       num
   __SCREAMING_SNAKE_CASE      							=       0
   while num > 0:
      __SCREAMING_SNAKE_CASE      							=       rev_num * 10 + (num % 10)
      num //= 10

   return num_copy == rev_num


if __name__ == "__main__":
    import doctest

    doctest.testmod()





