'''simple docstring'''

def        UpperCAmelCase__   (				_lowerCAmelCase    :			list[int])    ->		Union[str, Any]:



						"""simple docstring"""

						if len(_lowerCAmelCase) == 1:
												return a[0], a[0]
						else:
												# split A into half.
												snake_case :       List[str]				=    a[: len(_lowerCAmelCase) // 2]
												snake_case :       str				=    a[len(_lowerCAmelCase) // 2 :]

												# 2 sub problems, 1/2 of original size.
												snake_case :       List[Any]				=    max_difference(_lowerCAmelCase)
												snake_case :       int				=    max_difference(_lowerCAmelCase)

												# get min of first and max of second
												# linear time
												snake_case :       Union[str, Any]				=    min(_lowerCAmelCase)
												snake_case :       List[str]				=    max(_lowerCAmelCase)

												# 3 cases, either (small1, big1),
												# (min_first, max_second), (small2, big2)
												# constant comparisons
												if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
																		return smalla, biga
												elif biga - smalla > max_second - min_first:
																		return smalla, biga
												else:
																		return min_first, max_second


if __name__ == "__main__":
						import doctest

						doctest.testmod()










from __future__ import annotations





def     __lowerCamelCase							(   __magic_name__						:	int    ):
							for r in range(1  ,			__magic_name__    ):
														a__:							List[str]									=[]
														for x in range(n - 1    ):
																					a__:							int									=pow(__magic_name__  ,			__magic_name__  ,			__magic_name__    )
																					if val in li:
																												break
																					li.append(__magic_name__    )
														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)





