code: 
  
  
  
  from __future__ import annotations
  
  from typing import Generic, TypeVar
  
  __A       					=		TypeVar('''T''')
  
  
  
  
  
  
  class 	lowercase		(				Generic[T]):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	def __init__(			self			:		Dict		,						__UpperCAmelCase			:		T  )    ->				List[str]:
  							UpperCAmelCase_=     data  # Assign data
  							UpperCAmelCase_=     None  # Initialize next as null
  							UpperCAmelCase_=     None  # Initialize prev as null
  
  
  
  
  
  
  class 	lowercase		(				Generic[T]):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	def __init__(			self			:		int  )    ->				None:
  							UpperCAmelCase_=     None
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		int		,						__UpperCAmelCase			:		T  )    ->				None:
  							if self.head is None:
  													UpperCAmelCase_=     Node(__UpperCAmelCase  )
  							else:
  													UpperCAmelCase_=     Node(__UpperCAmelCase  )
  													UpperCAmelCase_=     new_node
  													UpperCAmelCase_=     self.head
  													UpperCAmelCase_=     None
  													UpperCAmelCase_=     new_node
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		List[str]  )    ->				T | None:
  							if self.head is None:
  													return None
  							else:
  													assert self.head is not None
  													UpperCAmelCase_=     self.head.data
  													UpperCAmelCase_=     self.head.next
  													if self.head is not None:
  																			UpperCAmelCase_=     None
  													return temp
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Union[str, Any]  )    ->				T | None:
  							return self.head.data if self.head is not None else None
  
  
  
  
  	def __len__(			self			:		str  )    ->				int:
  							UpperCAmelCase_=     self.head
  							UpperCAmelCase_=     0
  							while temp is not None:
  													count += 1
  													UpperCAmelCase_=     temp.next
  							return count
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		List[str]  )    ->				bool:
  							return self.head is None
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		List[str]  )    ->				None:
  							print("""stack elements are:"""  )
  							UpperCAmelCase_=     self.head
  							while temp is not None:
  													print(temp.data		,						end="""->"""  )
  													UpperCAmelCase_=     temp.next
  
  
  # Code execution starts here
  if __name__ == "__main__":
  	# Start with the empty stack
  	__A       					=		Stack()
  
  	# Insert 4 at the beginning. So stack becomes 4->None
  	print('''Stack operations using Doubly LinkedList''')
  	stack.push(4)
  
  	# Insert 5 at the beginning. So stack becomes 4->5->None
  	stack.push(5)
  
  	# Insert 6 at the beginning. So stack becomes 4->5->6->None
  	stack.push(6)
  
  	# Insert 7 at the beginning. So stack becomes 4->5->6->7->None
  	stack.push(7)
  
  	# Print the stack
  	stack.print_stack()
  
  	# Print the top element
  	print('''\nTop element is ''', stack.top())
  
  	# Print the stack size
  	print('''Size of the stack is ''', len(stack))
  
  	# pop the top element
  	stack.pop()
  
  	# pop the top element
  	stack.pop()
  
  	# two elements have now been popped off
  	stack.print_stack()
  
  	# Print True if the stack is empty else False
  	print('''\nstack is empty:''', stack.is_empty())
  
  
  
  
  
style_context: 
  
  
  
  from __future__ import annotations
  
  
  
  def  __a  (					lowerCAmelCase_     :      int       )   ->				int | None:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						for r in range(1    ,lowerCAmelCase_       ):
  												UpperCAmelCase_=     []
  												for x in range(n - 1       ):
  																		UpperCAmelCase_=     pow(lowerCAmelCase_    ,lowerCAmelCase_    ,lowerCAmelCase_       )
  																		if val in li:
  																								break
  																		li.append(lowerCAmelCase_       )
  												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)
  
  
  
  
  