code: 
  
  from __future__ import annotations
  
  
  
  def  _A  (			SCREAMING_SNAKE_CASE			):
  	for r in range(1  ,SCREAMING_SNAKE_CASE			):
  		UpperCAmelCase__:  Optional[int]		       =   []
  		for x in range(n - 1			):
  			UpperCAmelCase__:  Dict		       =   pow(SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			)
  			if val in li:
  				break
  			li.append(SCREAMING_SNAKE_CASE			)
  		else:
  			return r
  	return None
  
  
  if __name__ == "__main__":
  					_lowerCAmelCase     :			Optional[Any]    =int(input("""Enter a prime number q: """))
  					_lowerCAmelCase     :			int    =find_primitive(q)
  					if a is None:
  										print(F"Cannot find the primitive for the value: {a!r}")
  					else:
  										_lowerCAmelCase     :			Union[str, Any]    =int(input("""Enter private key of A: """))
  										_lowerCAmelCase     :			str    =pow(a, a_private, q)
  										_lowerCAmelCase     :			Any    =int(input("""Enter private key of B: """))
  										_lowerCAmelCase     :			List[str]    =pow(a, b_private, q)
  
  										_lowerCAmelCase     :			Optional[Any]    =pow(b_public, a_private, q)
  										_lowerCAmelCase     :			Optional[Any]    =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)
style_context: 
  
  _lowerCAmelCase     :			Optional[int]    ={
      """+""": lambda x, y: x + y,
      """-""": lambda x, y: x - y,
      """*""": lambda x, y: x * y,
      """/""": lambda x, y: x / y,
  }
  
  
  
  def  _A  (			SCREAMING_SNAKE_CASE			):
  	return c.isdigit()
  
  
  
  def  _A  (			SCREAMING_SNAKE_CASE			):
  	UpperCAmelCase__:  str		       =   []
  
  	# iterate over the string in reverse order
  	for c in expression.split()[::-1]:
  		# push operand to stack
  		if is_operand(SCREAMING_SNAKE_CASE			):
  			stack.append(int(SCREAMING_SNAKE_CASE			)			)
  
  		else:
  			# pop values from stack can calculate the result
  			# push the result onto the stack again
  			UpperCAmelCase__:  Any		       =   stack.pop()
  			UpperCAmelCase__:  int		       =   stack.pop()
  			stack.append(calc[c](SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			)			)
  
  	return stack.pop()
  
  
  # Driver code
  if __name__ == "__main__":
  					_lowerCAmelCase     :			Optional[int]    ="""+ 9 * 2 6"""
  					print(evaluate(test_expression))
  
  					_lowerCAmelCase     :			Optional[Any]    ="""/ * 10 2 + 4 1 """
  					print(evaluate(test_expression))