class 		a__						:






					class 		a__						:
										A     	=							'_prev', '_data', '_next'

										def __init__(   self				:	Any,_A				:	Any,_A				:	str,_A				:	Optional[int]   ):







												"""simple docstring"""






												SCREAMING_SNAKE_CASE_  :		int    				=   link_p
												SCREAMING_SNAKE_CASE_  :		List[Any]    				=   element
												SCREAMING_SNAKE_CASE_  :		Any    				=   link_n






										def     __UpperCamelCase       (   self				:	List[str]   ):







												"""simple docstring"""






												return (
												    F' Prev -> {self._prev is not None}, Next -> {self._next is not None}'
												)







					def __init__(   self				:	str   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Any    				=   self._Node(_A,_A,_A   )
							SCREAMING_SNAKE_CASE_  :		Any    				=   self._Node(_A,_A,_A   )
							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   self._trailer
							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   self._header
							SCREAMING_SNAKE_CASE_  :		Any    				=   0

					def __len__(   self				:	Any   ):







							"""simple docstring"""






							return self._size

					def     __UpperCamelCase       (   self				:	Dict   ):







							"""simple docstring"""






							return self.__len__() == 0

					def     __UpperCamelCase       (   self				:	List[Any],_A				:	List[str],_A				:	str,_A				:	List[str]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   self._Node(_A,_A,_A   )
							SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   new_node
							SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   new_node
							self._size += 1
							return self






					def     __UpperCamelCase       (   self				:	Any,_A				:	Dict   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		str    				=   node._prev
							SCREAMING_SNAKE_CASE_  :		int    				=   node._next

							SCREAMING_SNAKE_CASE_  :		Dict    				=   successor
							SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   predecessor
							self._size -= 1
							SCREAMING_SNAKE_CASE_  :		List[str]    				=   node._data
							SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   None
							del node
							return temp







class 		a__						( _DoublyLinkedBase ):

					def     __UpperCamelCase       (   self				:	List[Any]   ):







							"""simple docstring"""






							if self.is_empty():
									raise Exception("List is empty"   )
							return self._header._next._data

					def     __UpperCamelCase       (   self				:	Optional[Any]   ):







							"""simple docstring"""






							if self.is_empty():
									raise Exception("List is empty"   )
							return self._trailer._prev._data

					def     __UpperCamelCase       (   self				:	Optional[int],_A				:	Union[str, Any]   ):







							"""simple docstring"""






							return self._insert(self._header,_A,self._header._next   )

					def     __UpperCamelCase       (   self				:	Tuple,_A				:	Optional[Any]   ):







							"""simple docstring"""






							return self._insert(self._trailer._prev,_A,self._trailer   )

					def     __UpperCamelCase       (   self				:	Any   ):







							"""simple docstring"""






							if self.is_empty():
									raise IndexError("remove_first from empty list"   )
							return self._delete(self._header._next   )






					def     __UpperCamelCase       (   self				:	str   ):







							"""simple docstring"""






							if self.is_empty():
									raise IndexError("remove_first from empty list"   )
							return self._delete(self._trailer._prev   )

__lowerCamelCase :     List[Any]          =  {hex(i)[2:]: i for i in range(16)}  # Use [:2] to strip off the leading '0x'




def 				_snake_case     (       lowerCAmelCase							:       str     ):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   hex_string.strip().lower()
		if not hex_string:
				raise ValueError("Empty string was passed to the function"     )
		SCREAMING_SNAKE_CASE_  :		str    				=   hex_string[0] == "-"
		if is_negative:
				SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   hex_string[1:]
		if not all(char in hex_table for char in hex_string     ):
				raise ValueError("Non-hexadecimal value was passed to the function"     )
		SCREAMING_SNAKE_CASE_  :		List[Any]    				=   0
		for char in hex_string:
				SCREAMING_SNAKE_CASE_  :		Tuple    				=   1_6 * decimal_number + hex_table[char]
		return -decimal_number if is_negative else decimal_number


if __name__ == "__main__":
		from doctest import testmod

		testmod()
