




from __future__ import annotations

from typing import Generic, TypeVar

__SCREAMING_SNAKE_CASE     : str      =TypeVar("""T""")






class       A      (		Generic[T]		):
     """simple docstring"""

     def __init__(     self	: Union[str, Any]						,	A__	: T      )					->							Optional[Any]:
           lowerCamelCase__   	=					data  # Assign data
           lowerCamelCase__   	=					None  # Initialize next as null
           lowerCamelCase__   	=					None  # Initialize prev as null






class       A      (		Generic[T]		):
     """simple docstring"""

     def __init__(     self	: Optional[int]      )					->							None:
           lowerCamelCase__   	=					None




     def 			__snake_case (     self	: Optional[Any]						,	A__	: T      )					->							None:
           if self.head is None:
                 lowerCamelCase__   	=					Node(A__      )
           else:
                 lowerCamelCase__   	=					Node(A__      )
                 lowerCamelCase__   	=					new_node
                 lowerCamelCase__   	=					self.head
                 lowerCamelCase__   	=					None
                 lowerCamelCase__   	=					new_node




     def 			__snake_case (     self	: List[Any]      )					->							T | None:
           if self.head is None:
                 return None
           else:
                 assert self.head is not None
                 lowerCamelCase__   	=					self.head.data
                 lowerCamelCase__   	=					self.head.next
                 if self.head is not None:
                       lowerCamelCase__   	=					None
                 return temp




     def 			__snake_case (     self	: Any      )					->							T | None:
           return self.head.data if self.head is not None else None




     def __len__(     self	: Tuple      )					->							int:
           lowerCamelCase__   	=					self.head
           lowerCamelCase__   	=					0
           while temp is not None:
                 count += 1
                 lowerCamelCase__   	=					temp.next
           return count




     def 			__snake_case (     self	: Optional[Any]      )					->							bool:
           return self.head is None




     def 			__snake_case (     self	: List[Any]      )					->							None:
           print('stack elements are:'      )
           lowerCamelCase__   	=					self.head
           while temp is not None:
                 print(temp.data						,	end='->'      )
                 lowerCamelCase__   	=					temp.next


# Code execution starts here
if __name__ == "__main__":
      # Start with the empty stack
      __SCREAMING_SNAKE_CASE     : Stack[int]      =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())





def       lowerCAmelCase_      (	lowerCamelCase:							str    )       ->      int:


      '''simple docstring'''




      lowerCamelCase__   	=					53_81
      for x in s:
            lowerCamelCase__   	=					((hash_value << 5) + hash_value) + ord(lowerCamelCase    )
      return hash_value & 0Xffff_ffff