



from __future__ import annotations




def       __UpperCamelCase      (    _lowerCAmelCase ,	_lowerCAmelCase						)			->    Tuple:



    """simple docstring"""






    if b == 0:
        return (1, 0)
    (A)					:			Tuple		=  extended_euclid(UpperCAmelCase_ ,	a % b						)
    A					:			int		=  a // b
    return (y, x - k * y)




def       __UpperCamelCase      (    _lowerCAmelCase ,	_lowerCAmelCase ,	_lowerCAmelCase ,	_lowerCAmelCase						)			->    int:



    """simple docstring"""






    (A)					:			Union[str, Any]		=  extended_euclid(UpperCAmelCase_ ,	UpperCAmelCase_						)
    A					:			Optional[Any]		=  na * na
    A					:			int		=  ra * x * na + ra * y * na
    return (n % m + m) % m




def       __UpperCamelCase      (    _lowerCAmelCase ,	_lowerCAmelCase						)			->    List[str]:



    """simple docstring"""






    (A)					:			int		=  extended_euclid(UpperCAmelCase_ ,	UpperCAmelCase_						)
    if b < 0:
        A					:			Optional[Any]		=  (b % n + n) % n
    return b




def       __UpperCamelCase      (    _lowerCAmelCase ,	_lowerCAmelCase ,	_lowerCAmelCase ,	_lowerCAmelCase						)			->    str:



    """simple docstring"""






    A					:			Union[str, Any]		=  invert_modulo(UpperCAmelCase_ ,	UpperCAmelCase_						), invert_modulo(UpperCAmelCase_ ,	UpperCAmelCase_						)
    A					:			Tuple		=  na * na
    A					:			List[Any]		=  ra * x * na + ra * y * na
    return (n % m + m) % m


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

     testmod(name="""chinese_remainder_theorem""", verbose=True)
     testmod(name="""chinese_remainder_theorem2""", verbose=True)
     testmod(name="""invert_modulo""", verbose=True)
     testmod(name="""extended_euclid""", verbose=True)






from __future__ import annotations

from typing import Any







class 						_snake_case    ( _snake_case				):
 pass







class 						_snake_case    :




 def __init__(						self   ,    _lowerCamelCase       ):
       a		:Any									=			data
       a		:Node | None									=			None




 def __iter__(						self       ):
       a		:Dict									=			self
       a		:Optional[int]									=			[]
       while node:
             if node in visited:
                   raise ContainsLoopError
             visited.append(_lowerCamelCase       )
             yield node.data
             a		:str									=			node.next_node




 @property
 def 			SCREAMING_SNAKE_CASE__							(						self       ):
       try:
             list(self       )
             return False
       except ContainsLoopError:
             return True


if __name__ == "__main__":
     snake_case							:       int										=	Node(1)
     snake_case							:       int										=	Node(2)
     snake_case							:       Optional[int]										=	Node(3)
     snake_case							:       List[str]										=	Node(4)
     print(root_node.has_loop)  # False
     snake_case							:       Optional[Any]										=	root_node.next_node
     print(root_node.has_loop)  # True

     snake_case							:       Dict										=	Node(5)
     snake_case							:       List[Any]										=	Node(6)
     snake_case							:       Optional[int]										=	Node(5)
     snake_case							:       Union[str, Any]										=	Node(6)
     print(root_node.has_loop)  # False

     snake_case							:       Tuple										=	Node(1)
     print(root_node.has_loop)  # False





