
from __future__ import annotations







def  UpperCAmelCase_   (_lowerCAmelCase :		int		):
			for r in range(1     ,			_lowerCAmelCase		):
						__UpperCamelCase    :    Union[str, Any]								=      []
						for x in range(n - 1		):
									__UpperCamelCase    :    Dict								=      pow(_lowerCAmelCase     ,			_lowerCAmelCase     ,			_lowerCAmelCase		)
									if val in li:
												break
									li.append(_lowerCAmelCase		)
						else:
									return r
			return None


if __name__ == "__main__":
					lowercase     :       Optional[int]        =       int(input("Enter a prime number q: "))
					lowercase     :       Dict        =       find_primitive(q)
					if a is None:
										print(F"""Cannot find the primitive for the value: {a!r}""")
					else:
										lowercase     :       Tuple        =       int(input("Enter private key of A: "))
										lowercase     :       Dict        =       pow(a, a_private, q)
										lowercase     :       Optional[int]        =       int(input("Enter private key of B: "))
										lowercase     :       Optional[Any]        =       pow(a, b_private, q)

										lowercase     :       str        =       pow(b_public, a_private, q)
										lowercase     :       Union[str, Any]        =       pow(a_public, b_private, q)

										print("The key value generated by A is: ", a_secret)
										print("The key value generated by B is: ", b_secret)


from collections.abc import Callable

lowercase     :       Optional[Any]        =       Callable[[float], float]  # type alias for a real -> real function







def  UpperCAmelCase_   (_lowerCAmelCase :		RealFunc     ,			_lowerCAmelCase :		RealFunc     ,			_lowerCAmelCase :		int     ,			):
			__UpperCamelCase    :    Any								=      float(_lowerCAmelCase		)
			while True:
						try:
									__UpperCamelCase    :    List[Any]								=      prev_guess - function(_lowerCAmelCase		) / derivative(_lowerCAmelCase		)
						except ZeroDivisionError:
									raise ZeroDivisionError("Could not find root"		) from None
						if abs(prev_guess - next_guess		) < 10**-5:
									return next_guess
						__UpperCamelCase    :    Tuple								=      next_guess







def  UpperCAmelCase_   (_lowerCAmelCase :		float		):
			return (x**3) - (2 * x) - 5







def  UpperCAmelCase_   (_lowerCAmelCase :		float		):
			return 3 * (x**2) - 2


if __name__ == "__main__":
					print(newton(f, fa, 3))