



from __future__ import annotations

def   SCREAMING_SNAKE_CASE_       (  _snake_case  :int							)     ->    int | None:
   for r in range(1  ,      _snake_case							):
      _A						     =					[]
      for x in range(n - 1							):
         _A						     =					pow(_snake_case  ,      _snake_case  ,      _snake_case							)
         if val in li:
            break
         li.append(_snake_case							)
      else:
         return r
   return None


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

        UpperCAmelCase_		   =				pow(b_public, a_private, q)
        UpperCAmelCase_		   =				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 __future__ import annotations

def   SCREAMING_SNAKE_CASE_       (  _snake_case  :int							)     ->    int | None:
   for r in range(1  ,      _snake_case							):
      _A						     =					[]
      for x in range(n - 1							):
         _A						     =					pow(_snake_case  ,      _snake_case  ,      _snake_case							)
         if val in li:
            break
         li.append(_snake_case							)
      else:
         return r
   return None


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

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



