




from __future__ import annotations

import random
from collections.abc import Iterable
from typing import Any, Generic, TypeVar

__lowerCAmelCase						:							List[Any]			     =						TypeVar('T', bound=bool)




class        snake_case__				(Generic[T]  ):
				"""simple docstring"""



				def __init__( self							:	int   , __lowerCamelCase							:	T				)   ->	None:
							a       =     value
							a       =     None
							a       =     None





				@property
				def 				__UpperCAmelCase				( self							:	List[str]				)   ->	T:
							return self._value





				@staticmethod
				def 				__UpperCAmelCase				( __lowerCamelCase							:	RandomizedHeapNode[T] | None   , __lowerCamelCase							:	RandomizedHeapNode[T] | None				)   ->	RandomizedHeapNode[T] | None:
							if not roota:
										return roota

							if not roota:
										return roota

							if roota.value > roota.value:
										a       =     roota, roota

							if random.choice([True, False]				):
										a       =     roota.right, roota.left

							a       =     RandomizedHeapNode.merge(roota.left   , _a				)

							return roota




class        snake_case__				(Generic[T]  ):
				"""simple docstring"""



				def __init__( self							:	Any   , __lowerCamelCase							:	Iterable[T] | None = ()				)   ->	None:
							a       =     None

							if data:
										for item in data:
													self.insert(_a				)





				def 				__UpperCAmelCase				( self							:	Any   , __lowerCamelCase							:	T				)   ->	None:
							a       =     RandomizedHeapNode.merge(self._root   , RandomizedHeapNode(_a				)				)





				def 				__UpperCAmelCase				( self							:	Dict				)   ->	T | None:
							a       =     self.top()

							if self._root is None:
										return None

							a       =     RandomizedHeapNode.merge(self._root.left   , self._root.right				)

							return result





				def 				__UpperCAmelCase				( self							:	Optional[Any]				)   ->	T:
							if not self._root:
										raise IndexError("Can't get top element for the empty heap."				)
							return self._root.value





				def 				__UpperCAmelCase				( self							:	Union[str, Any]				)   ->	None:
							a       =     None





				def 				__UpperCAmelCase				( self							:	List[str]				)   ->	list[Any]:
							a       =     []
							while self:
										result.append(self.pop()				)

							return result





				def __bool__( self							:	int				)   ->	bool:
							return self._root is not None


if __name__ == "__main__":
		import doctest

		doctest.testmod()










from __future__ import annotations

import sys







def 	A (		A__		,		A__			):
     # base cases
     if abs(A__			) == 1:
          return a, 0
     elif abs(A__			) == 1:
          return 0, b

     UpperCAmelCase	,			UpperCAmelCase    :					Any			=      a, b
     UpperCAmelCase	,			UpperCAmelCase    :					List[Any]			=      1, 0
     UpperCAmelCase	,			UpperCAmelCase    :					Union[str, Any]			=      0, 1

     while remainder != 0:
          UpperCAmelCase    :					Union[str, Any]			=      old_remainder // remainder
          UpperCAmelCase	,			UpperCAmelCase    :					Dict			=      remainder, old_remainder - quotient * remainder
          UpperCAmelCase	,			UpperCAmelCase    :					int			=      coeff_a, old_coeff_a - quotient * coeff_a
          UpperCAmelCase	,			UpperCAmelCase    :					Optional[Any]			=      coeff_b, old_coeff_b - quotient * coeff_b

     # sign correction for negative numbers
     if a < 0:
          UpperCAmelCase    :					Union[str, Any]			=      -old_coeff_a
     if b < 0:
          UpperCAmelCase    :					int			=      -old_coeff_b

     return old_coeff_a, old_coeff_b







def 	A (		):
     if len(sys.argv			) < 3:
          print("2 integer arguments required"			)
          return 1
     UpperCAmelCase    :					Union[str, Any]			=      int(sys.argv[1]			)
     UpperCAmelCase    :					Any			=      int(sys.argv[2]			)
     print(extended_euclidean_algorithm(A__		,		A__			)			)
     return 0


if __name__ == "__main__":
      raise SystemExit(main())



