





from __future__ import annotations




def 			lowerCAmelCase_			(				UpperCamelCase_	)  ->		int | None:
       for r in range(1       ,		UpperCamelCase_	):
              UpperCamelCase_ 							=	[]
              for x in range(n - 1	):
                     UpperCamelCase_ 							=	pow(UpperCamelCase_       ,		UpperCamelCase_       ,		UpperCamelCase_	)
                     if val in li:
                            break
                     li.append(UpperCamelCase_	)
              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)





"""simple docstring"""
from __future__ import annotations

import math
import random






def 						lowercase				(	_snake_case		: int	,  _snake_case		: int	,  _snake_case		: int	)	->list[int]:
	"""simple docstring"""





	__snake_case      :		Tuple         =							d * e - 1
	__snake_case      :		List[str]         =							0
	__snake_case      :		Dict         =							0
	while p == 0:
		__snake_case      :		str         =							random.randint(2	,  n - 1	)
		__snake_case      :		int         =							k
		while True:
			if t % 2 == 0:
				__snake_case      :		int         =							t // 2
				__snake_case      :		int         =							(g**t) % n
				__snake_case      :		Optional[Any]         =							math.gcd(x - 1	,  _snake_case	)
				if x > 1 and y > 1:
					__snake_case      :		Tuple         =							y
					__snake_case      :		int         =							n // y
					break  # find the correct factors
			else:
				break  # t is not divisible by 2, break and choose another g
	return sorted([p, q]	)


if __name__ == "__main__":
			import doctest

			doctest.testmod()





