class 				a_ :






 '''simple docstring'''






 def __init__(			self					:  List[str]):







        '''simple docstring'''



        lowerCAmelCase__     	=					{}
        # indexmap keys are an index and it's values are the number at that index
        lowerCAmelCase__     	=					{}




 def 		__snake_case						(			self					:  Tuple			,    lowercase__					:  Optional[Any]			,    lowercase__					:  Dict):







        '''simple docstring'''



        if isinstance(UpperCAmelCase_			,    (range, str)):
               lowerCAmelCase__     	=					list(UpperCAmelCase_)
        elif not isinstance(UpperCAmelCase_			,    UpperCAmelCase_):
               raise TypeError(
                   'binary_search_delete() only accepts either a list, range or str')

        lowerCAmelCase__     	=					0
        lowerCAmelCase__     	=					len(UpperCAmelCase_) - 1

        while low <= high:
               lowerCAmelCase__     	=					(low + high) // 2
               if array[mid] == item:
                      array.pop(UpperCAmelCase_)
                      return array
               elif array[mid] < item:
                      lowerCAmelCase__     	=					mid + 1
               else:
                      lowerCAmelCase__     	=					mid - 1
        raise ValueError(
            'Either the item is not in the array or the array was unsorted')




 def 		__snake_case						(			self					:  Any			,    lowercase__					:  Optional[int]			,    lowercase__					:  Optional[int]):







        '''simple docstring'''



        if isinstance(UpperCAmelCase_			,    (range, str)):
               lowerCAmelCase__     	=					list(UpperCAmelCase_)
        elif not isinstance(UpperCAmelCase_			,    UpperCAmelCase_):
               raise TypeError(
                   'binary_search_insert() only accepts either a list, range or str')

        lowerCAmelCase__     	=					0
        lowerCAmelCase__     	=					len(UpperCAmelCase_) - 1

        while low <= high:
               lowerCAmelCase__     	=					(low + high) // 2
               if array[mid] == index:
                      # If the item already exists in the array,
                      # insert it after the existing item
                      array.insert(mid + 1			,    UpperCAmelCase_)
                      return array
               elif array[mid] < index:
                      lowerCAmelCase__     	=					mid + 1
               else:
                      lowerCAmelCase__     	=					mid - 1

        # If the item doesn't exist in the array, insert it at the appropriate position
        array.insert(UpperCAmelCase_			,    UpperCAmelCase_)
        return array




 def 		__snake_case						(			self					:  int			,    lowercase__					:  List[str]			,    lowercase__					:  List[str]):







        '''simple docstring'''



        if index in self.indexmap:
               lowerCAmelCase__     	=					self.indexmap[index]
               if len(self.numbermap[n]) == 1:
                      del self.numbermap[n]
               else:
                      lowerCAmelCase__     	=					self.binary_search_delete(self.numbermap[n]			,    UpperCAmelCase_)

        # Set new index
        lowerCAmelCase__     	=					number

        # Number not seen before or empty so insert number value
        if number not in self.numbermap:
               lowerCAmelCase__     	=					[index]

        # Here we need to perform a binary search insertion in order to insert
        # The item in the correct place
        else:
               lowerCAmelCase__     	=					self.binary_search_insert(
                   self.numbermap[number]			,    UpperCAmelCase_)




 def 		__snake_case						(			self					:  Any			,    lowercase__					:  List[Any]):







        '''simple docstring'''



        return self.numbermap.get(UpperCAmelCase_			,    [-1])[0]


if __name__ == "__main__":
    import doctest

    doctest.testmod()


"""simple docstring"""

from __future__ import annotations
def 		UpperCAmelCase					(		a_			):





		'''simple docstring'''


		for r in range(1,						a_			):
				lowerCamelCase     :			Tuple		=    []
				for x in range(n - 1			):
						lowerCamelCase     :			List[str]		=    pow(a_,						a_,						a_			)
						if val in li:
								break
						li.append(a_			)
				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)






