


"""simple docstring"""







from __future__ import annotations

from typing import Generic, TypeVar

__lowercase          = TypeVar("""T""")






class 		_A    (    Generic[T]    ):







    """simple docstring"""




    def __init__(   self							:       Any							,					__UpperCAmelCase							:       T):
      a		:						Optional[int] 				=     data  # Assign data
      a		:						Node[T] | None 				=     None  # Initialize next as null
      a		:						Node[T] | None 				=     None  # Initialize prev as null






class 		_A    (    Generic[T]    ):







    """simple docstring"""




    def __init__(   self							:       Optional[int]):
      a		:						Node[T] | None 				=     None






    def       __snake_case				(   self							:       Optional[int]							,					__UpperCAmelCase							:       T):
      if self.head is None:
        a		:						List[Any] 				=     Node(__UpperCAmelCase)
      else:
        a		:						str 				=     Node(__UpperCAmelCase)
        a		:						int 				=     new_node
        a		:						Union[str, Any] 				=     self.head
        a		:						Dict 				=     None
        a		:						Tuple 				=     new_node






    def       __snake_case				(   self							:       Union[str, Any]):
      if self.head is None:
        return None
      else:
        assert self.head is not None
        a		:						Optional[int] 				=     self.head.data
        a		:						Dict 				=     self.head.next
        if self.head is not None:
          a		:						Tuple 				=     None
        return temp






    def       __snake_case				(   self							:       List[Any]):
      return self.head.data if self.head is not None else None






    def __len__(   self							:       Optional[Any]):
      a		:						Optional[Any] 				=     self.head
      a		:						Optional[Any] 				=     0
      while temp is not None:
        count += 1
        a		:						Any 				=     temp.next
      return count






    def       __snake_case				(   self							:       Optional[int]):
      return self.head is None






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


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










"""simple docstring"""







def 	lowercase     (							A_ = 100    ,  A_ = 100			)-> int:
  '''simple docstring'''







  return max(
      sum(int(A_			) for x in str(base**power			)			)
      for base in range(A_			)
      for power in range(A_			)			)


# Tests
if __name__ == "__main__":
 import doctest

 doctest.testmod()






