"""simple docstring"""


class   __UpperCAmelCase		:

				def __init__( self      ,					_lowerCamelCase      ,					_lowerCamelCase=None      ,					_lowerCamelCase=None ):
										lowerCamelCase__   =data
										lowerCamelCase__   =previous
										lowerCamelCase__   =next_node

				def __str__( self ):
										return F'''{self.data}'''

				def 						_a      ( self ):
										return self.data

				def 						_a      ( self ):
										return self.next






				def 						_a      ( self ):
										return self.previous






class   __UpperCAmelCase		:

				def __init__( self      ,					_lowerCamelCase ):
										lowerCamelCase__   =head

				def __iter__( self ):
										return self






				def 						_a      ( self ):
										if not self.current:
																raise StopIteration
										else:
																lowerCamelCase__   =self.current.get_data()
																lowerCamelCase__   =self.current.get_next()
																return value






class   __UpperCAmelCase		:

				def __init__( self ):
										lowerCamelCase__   =None  # First node in list
										lowerCamelCase__   =None  # Last node in list

				def __str__( self ):
										lowerCamelCase__   =self.head
										lowerCamelCase__   =[]
										while current is not None:
																nodes.append(current.get_data() )
																lowerCamelCase__   =current.get_next()
										return " ".join(str(_lowerCamelCase ) for node in nodes )

				def __contains__( self      ,					_lowerCamelCase ):
										lowerCamelCase__   =self.head
										while current:
																if current.get_data() == value:
																						return True
																lowerCamelCase__   =current.get_next()
										return False

				def __iter__( self ):
										return LinkedListIterator(self.head )

				def 						_a      ( self ):
										if self.head:
																return self.head.get_data()
										return None

				def 						_a      ( self ):
										if self.tail:
																return self.tail.get_data()
										return None

				def 						_a      ( self      ,					_lowerCamelCase ):
										if self.head is None:
																lowerCamelCase__   =node
																lowerCamelCase__   =node
										else:
																self.insert_before_node(self.head      ,					_lowerCamelCase )

				def 						_a      ( self      ,					_lowerCamelCase ):
										if self.head is None:
																self.set_head(_lowerCamelCase )
										else:
																self.insert_after_node(self.tail      ,					_lowerCamelCase )

				def 						_a      ( self      ,					_lowerCamelCase ):
										lowerCamelCase__   =Node(_lowerCamelCase )
										if self.head is None:
																self.set_head(_lowerCamelCase )
										else:
																self.set_tail(_lowerCamelCase )

				def 						_a      ( self      ,					_lowerCamelCase      ,					_lowerCamelCase ):
										lowerCamelCase__   =node
										lowerCamelCase__   =node.previous

										if node.get_previous() is None:
																lowerCamelCase__   =node_to_insert
										else:
																lowerCamelCase__   =node_to_insert

										lowerCamelCase__   =node_to_insert

				def 						_a      ( self      ,					_lowerCamelCase      ,					_lowerCamelCase ):
										lowerCamelCase__   =node
										lowerCamelCase__   =node.next

										if node.get_next() is None:
																lowerCamelCase__   =node_to_insert
										else:
																lowerCamelCase__   =node_to_insert

										lowerCamelCase__   =node_to_insert

				def 						_a      ( self      ,					_lowerCamelCase      ,					_lowerCamelCase ):
										lowerCamelCase__   =1
										lowerCamelCase__   =Node(_lowerCamelCase )
										lowerCamelCase__   =self.head
										while node:
																if current_position == position:
																						self.insert_before_node(_lowerCamelCase      ,					_lowerCamelCase )
																						return
																current_position += 1
																lowerCamelCase__   =node.next
										self.insert_after_node(self.tail      ,					_lowerCamelCase )

				def 						_a      ( self      ,					_lowerCamelCase ):
										lowerCamelCase__   =self.head
										while node:
																if node.get_data() == item:
																						return node
																lowerCamelCase__   =node.get_next()
										raise Exception("Node not found" )

				def 						_a      ( self      ,					_lowerCamelCase ):
										if (node := self.get_node(_lowerCamelCase )) is not None:
																if node == self.head:
																						lowerCamelCase__   =self.head.get_next()

																if node == self.tail:
																						lowerCamelCase__   =self.tail.get_previous()

																self.remove_node_pointers(_lowerCamelCase )

				@staticmethod
				def 						_a      ( _lowerCamelCase ):
										if node.get_next():
																lowerCamelCase__   =node.previous

										if node.get_previous():
																lowerCamelCase__   =node.next

										lowerCamelCase__   =None
										lowerCamelCase__   =None






				def 						_a      ( self ):
										return self.head is None





def      lowerCamelCase_					(   )				->   None:




						'''simple docstring'''





if __name__ == "__main__":
	import doctest

	doctest.testmod()



"""simple docstring"""


from .imports import is_rich_available


if is_rich_available():
	from rich.traceback import install

	install(show_locals=False)

else:
	raise ModuleNotFoundError('To use the rich extension, install rich with `pip install rich`')


