code: 
  
  
  
  import logging
  import os
  import sys
  import threading
  from logging import (
      CRITICAL,  # NOQA
      DEBUG,  # NOQA
      ERROR,  # NOQA
      FATAL,  # NOQA
      INFO,  # NOQA
      NOTSET,  # NOQA
      WARN,  # NOQA
      WARNING,  # NOQA
  )
  from typing import Optional
  
  from tqdm import auto as tqdm_lib
  
  
  __A       					=		threading.Lock()
  __A       					=		None
  
  __A       					=		{
      '''debug''': logging.DEBUG,
      '''info''': logging.INFO,
      '''warning''': logging.WARNING,
      '''error''': logging.ERROR,
      '''critical''': logging.CRITICAL,
  }
  
  __A       					=		logging.WARNING
  
  __A       					=		True
  
  
  
  def 		__a  (					)   ->				Any:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						UpperCAmelCase_=     os.getenv("""DIFFUSERS_VERBOSITY"""    ,_A       )
  						if env_level_str:
  												if env_level_str in log_levels:
  																		return log_levels[env_level_str]
  												else:
  																		logging.getLogger().warning(
  																		    F"""Unknown option DIFFUSERS_VERBOSITY={env_level_str}, """
  																		    F"""has to be one of: { ", ".join(log_levels.keys()       ) }"""       )
  						return _default_log_level
  
  
  
  def 		__a  (					)   ->				Optional[Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						return __name__.split("""."""       )[0]
  
  
  
  def 		__a  (					)   ->				List[Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						return logging.getLogger(_get_library_name()       )
  
  
  
  def 		__a  (					)   ->				List[Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						global _default_handler
  
  						with _lock:
  												if _default_handler:
  																		# This library has already configured the library root logger.
  																		return
  												UpperCAmelCase_=     logging.StreamHandler()  # Set sys.stderr as stream.
  												UpperCAmelCase_=     sys.stderr.flush
  
  												# Apply our default configuration to the library root logger.
  												UpperCAmelCase_=     _get_library_root_logger()
  												library_root_logger.addHandler(_default_handler       )
  												library_root_logger.setLevel(_get_default_logging_level()       )
  												UpperCAmelCase_=     False
  
  
  
  def 		__a  (					)   ->				Dict:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						global _default_handler
  
  						with _lock:
  												if not _default_handler:
  																		return
  
  												UpperCAmelCase_=     _get_library_root_logger()
  												library_root_logger.removeHandler(_default_handler       )
  												library_root_logger.setLevel(logging.NOTSET       )
  												UpperCAmelCase_=     None
  
  
  
  def 		__a  (					)   ->				str:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						return log_levels
  
  
  
  def 		__a  (					lowerCAmelCase_     :      Optional[str] = None       )   ->				Any:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						if name is None:
  												UpperCAmelCase_=     _get_library_name()
  
  						_configure_library_root_logger()
  						return logging.getLogger(_A       )
  
  
  
  def 		__a  (					)   ->				Dict:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						_configure_library_root_logger()
  						return _get_library_root_logger().getEffectiveLevel()
  
  
  
  def 		__a  (					lowerCAmelCase_     :      int       )   ->				Optional[int]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						_configure_library_root_logger()
  						_get_library_root_logger().setLevel(_A       )
  
  
  
  def 		__a  (					)   ->				Any:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						return set_verbosity(_A       )
  
  
  
  def 		__a  (					)   ->				List[Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						return set_verbosity(_A       )
  
  
  
  def 		__a  (					)   ->				Optional[Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						return set_verbosity(_A       )
  
  
  
  def 		__a  (					)   ->				Optional[Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						return set_verbosity(_A       )
  
  
  
  def 		__a  (					)   ->				Tuple:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						_configure_library_root_logger()
  
  						assert _default_handler is not None
  						_get_library_root_logger().removeHandler(_default_handler       )
  
  
  
  def 		__a  (					)   ->				str:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						_configure_library_root_logger()
  
  						assert _default_handler is not None
  						_get_library_root_logger().addHandler(_default_handler       )
  
  
  
  def 		__a  (					lowerCAmelCase_     :      logging.Handler       )   ->				Any:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						_configure_library_root_logger()
  
  						assert handler is not None
  						_get_library_root_logger().addHandler(_A       )
  
  
  
  def 		__a  (					lowerCAmelCase_     :      logging.Handler       )   ->				int:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						_configure_library_root_logger()
  
  						assert handler is not None and handler not in _get_library_root_logger().handlers
  						_get_library_root_logger().removeHandler(_A       )
  
  
  
  def 		__a  (					)   ->				Union[str, Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						_configure_library_root_logger()
  						UpperCAmelCase_=     False
  
  
  
  def 		__a  (					)   ->				int:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						_configure_library_root_logger()
  						UpperCAmelCase_=     True
  
  
  
  def 		__a  (					)   ->				Optional[int]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						UpperCAmelCase_=     _get_library_root_logger().handlers
  
  						for handler in handlers:
  												UpperCAmelCase_=     logging.Formatter("""[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s"""       )
  												handler.setFormatter(_A       )
  
  
  
  def 		__a  (					)   ->				int:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						UpperCAmelCase_=     _get_library_root_logger().handlers
  
  						for handler in handlers:
  												handler.setFormatter(_A       )
  
  
  
  def 		__a  (					self     :      List[Any]    ,*lowerCAmelCase_     :      int    ,**lowerCAmelCase_     :      Any       )   ->				Optional[Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						UpperCAmelCase_=     os.getenv("""DIFFUSERS_NO_ADVISORY_WARNINGS"""    ,_A       )
  						if no_advisory_warnings:
  												return
  						self.warning(*_A    ,**_A       )
  
  
  __A       					=		warning_advice
  
  
  
  
  
  
  class 	lowercase		:
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	def __init__(			self			:		Union[str, Any]		,						*__UpperCAmelCase			:		Dict		,						**__UpperCAmelCase			:		Union[str, Any]  )    ->				Optional[Any]:  # pylint: disable=unused-argument
  							UpperCAmelCase_=     args[0] if args else None
  
  
  
  
  	def __iter__(			self			:		List[Any]  )    ->				List[str]:
  							return iter(self._iterator  )
  
  
  
  
  	def __getattr__(			self			:		List[str]		,						__UpperCAmelCase			:		str  )    ->				int:
  
  
  
  
  
  
  							def empty_fn(*__UpperCAmelCase			:		Optional[Any]		,						**__UpperCAmelCase			:		Any  ):  # pylint: disable=unused-argument
  													return
  
  							return empty_fn
  
  
  
  
  	def __enter__(			self			:		List[Any]  )    ->				Dict:
  							return self
  
  
  
  
  	def __exit__(			self			:		List[str]		,						__UpperCAmelCase			:		Optional[int]		,						__UpperCAmelCase			:		List[Any]		,						__UpperCAmelCase			:		Optional[Any]  )    ->				Any:
  							return
  
  
  
  
  
  
  class 	lowercase		:
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	def __call__(			self			:		Optional[int]		,						*__UpperCAmelCase			:		Dict		,						**__UpperCAmelCase			:		str  )    ->				List[Any]:
  
  
  
  
  
  
  							if _tqdm_active:
  													return tqdm_lib.tqdm(*lowercase_		,						**lowercase_  )
  							else:
  													return EmptyTqdm(*lowercase_		,						**lowercase_  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Tuple		,						*__UpperCAmelCase			:		Optional[Any]		,						**__UpperCAmelCase			:		Dict  )    ->				str:
  							UpperCAmelCase_=     None
  							if _tqdm_active:
  													return tqdm_lib.tqdm.set_lock(*lowercase_		,						**lowercase_  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		List[Any]  )    ->				int:
  
  
  
  
  
  
  							if _tqdm_active:
  													return tqdm_lib.tqdm.get_lock()
  
  __A       					=		_tqdm_cls()
  
  
  
  def 		__a  (					)   ->				List[str]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						global _tqdm_active
  						return bool(_tqdm_active       )
  
  
  
  def 		__a  (					)   ->				str:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						global _tqdm_active
  						UpperCAmelCase_=     True
  
  
  
  def 		__a  (					)   ->				Optional[Any]:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						global _tqdm_active
  						UpperCAmelCase_=     False
  
  
  
  
  
style_context: 
  
  
  
  from __future__ import annotations
  
  
  
  def  __a  (					lowerCAmelCase_     :      int       )   ->				int | None:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						for r in range(1    ,lowerCAmelCase_       ):
  												UpperCAmelCase_=     []
  												for x in range(n - 1       ):
  																		UpperCAmelCase_=     pow(lowerCAmelCase_    ,lowerCAmelCase_    ,lowerCAmelCase_       )
  																		if val in li:
  																								break
  																		li.append(lowerCAmelCase_       )
  												else:
  																		return r
  						return None
  
  
  if __name__ == "__main__":
  	__A       					=		int(input('''Enter a prime number q: '''))
  	__A       					=		find_primitive(q)
  	if a is None:
  		print(f'Cannot find the primitive for the value: {a!r}')
  	else:
  		__A       					=		int(input('''Enter private key of A: '''))
  		__A       					=		pow(a, a_private, q)
  		__A       					=		int(input('''Enter private key of B: '''))
  		__A       					=		pow(a, b_private, q)
  
  		__A       					=		pow(b_public, a_private, q)
  		__A       					=		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)
  
  
  
  
  