

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_SCREAMING_SNAKE_CASE							 =			{'''configuration_qdqbert''': ['''QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''QDQBertConfig''']}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      _SCREAMING_SNAKE_CASE							 =			[
          '''QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''QDQBertForMaskedLM''',
          '''QDQBertForMultipleChoice''',
          '''QDQBertForNextSentencePrediction''',
          '''QDQBertForQuestionAnswering''',
          '''QDQBertForSequenceClassification''',
          '''QDQBertForTokenClassification''',
          '''QDQBertLayer''',
          '''QDQBertLMHeadModel''',
          '''QDQBertModel''',
          '''QDQBertPreTrainedModel''',
          '''load_tf_weights_in_qdqbert''',
      ]


if TYPE_CHECKING:
      from .configuration_qdqbert import QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, QDQBertConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_qdqbert import (
                QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
                QDQBertForMaskedLM,
                QDQBertForMultipleChoice,
                QDQBertForNextSentencePrediction,
                QDQBertForQuestionAnswering,
                QDQBertForSequenceClassification,
                QDQBertForTokenClassification,
                QDQBertLayer,
                QDQBertLMHeadModel,
                QDQBertModel,
                QDQBertPreTrainedModel,
                load_tf_weights_in_qdqbert,
            )


else:
      import sys

      _SCREAMING_SNAKE_CASE							 =			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)








from __future__ import annotations





def  _snake_case		(snake_case_					:     int  )							->		int | None:
  for r in range(1    ,       snake_case_  ):
    __UpperCAmelCase	:  List[str]		=     []
    for x in range(n - 1  ):
      __UpperCAmelCase	:  Union[str, Any]		=     pow(snake_case_    ,       snake_case_    ,       snake_case_  )
      if val in li:
        break
      li.append(snake_case_  )
    else:
      return r
  return None


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

            _SCREAMING_SNAKE_CASE							 =			pow(b_public, a_private, q)
            _SCREAMING_SNAKE_CASE							 =			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)





