




class 						SCREAMING_SNAKE_CASE__		:
     def __init__(	self  :		Dict					,	__lowerCamelCase  :		List[Any]	):



       """simple docstring"""
       lowerCAmelCase__								=			data
       lowerCAmelCase__								=			None
       lowerCAmelCase__								=			None



     def __str__(	self  :		Any	):



       """simple docstring"""
       return F"""{self.data}"""





class 						SCREAMING_SNAKE_CASE__		:
     def __init__(	self  :		str	):



       """simple docstring"""
       lowerCAmelCase__								=			None
       lowerCAmelCase__								=			None
     def __iter__(	self  :		Union[str, Any]	):



       """simple docstring"""
       lowerCAmelCase__								=			self.head
       while node:
         yield node.data
         lowerCAmelCase__								=			node.next
     def __str__(	self  :		Optional[Any]	):



       """simple docstring"""
       return "->".join([str(lowerCamelCase_	) for item in self]	)
     def __len__(	self  :		Optional[Any]	):



       """simple docstring"""
       return sum(1 for _ in self	)
     def 					A__			(	self  :		Any					,	__lowerCamelCase  :		Union[str, Any]	):



       """simple docstring"""
       self.insert_at_nth(0					,	lowerCamelCase_	)
     def 					A__			(	self  :		List[str]					,	__lowerCamelCase  :		Dict	):



       """simple docstring"""
       self.insert_at_nth(len(self	)					,	lowerCamelCase_	)
     def 					A__			(	self  :		Any					,	__lowerCamelCase  :		Optional[Any]					,	__lowerCamelCase  :		List[str]	):



       """simple docstring"""
       lowerCAmelCase__								=			len(self	)

       if not 0 <= index <= length:
         raise IndexError('''list index out of range'''	)
       lowerCAmelCase__								=			Node(lowerCamelCase_	)
       if self.head is None:
         lowerCAmelCase__								=			lowerCAmelCase__								=			new_node
       elif index == 0:
         lowerCAmelCase__								=			new_node
         lowerCAmelCase__								=			self.head
         lowerCAmelCase__								=			new_node
       elif index == length:
         lowerCAmelCase__								=			new_node
         lowerCAmelCase__								=			self.tail
         lowerCAmelCase__								=			new_node
       else:
         lowerCAmelCase__								=			self.head
         for _ in range(0					,	lowerCamelCase_	):
           lowerCAmelCase__								=			temp.next
         lowerCAmelCase__								=			new_node
         lowerCAmelCase__								=			temp.previous
         lowerCAmelCase__								=			temp
         lowerCAmelCase__								=			new_node
     def 					A__			(	self  :		Dict	):



       """simple docstring"""
       return self.delete_at_nth(0	)
     def 					A__			(	self  :		Tuple	):



       """simple docstring"""
       return self.delete_at_nth(len(self	) - 1	)
     def 					A__			(	self  :		List[str]					,	__lowerCamelCase  :		Tuple	):



       """simple docstring"""
       lowerCAmelCase__								=			len(self	)

       if not 0 <= index <= length - 1:
         raise IndexError('''list index out of range'''	)
       lowerCAmelCase__								=			self.head  # default first node
       if length == 1:
         lowerCAmelCase__								=			lowerCAmelCase__								=			None
       elif index == 0:
         lowerCAmelCase__								=			self.head.next
         lowerCAmelCase__								=			None
       elif index == length - 1:
         lowerCAmelCase__								=			self.tail
         lowerCAmelCase__								=			self.tail.previous
         lowerCAmelCase__								=			None
       else:
         lowerCAmelCase__								=			self.head
         for _ in range(0					,	lowerCamelCase_	):
           lowerCAmelCase__								=			temp.next
         lowerCAmelCase__								=			temp
         lowerCAmelCase__								=			temp.previous
         lowerCAmelCase__								=			temp.next
       return delete_node.data
     def 					A__			(	self  :		Dict					,	__lowerCamelCase  :		Dict	):



       """simple docstring"""
       lowerCAmelCase__								=			self.head

       while current.data != data:  # Find the position to delete
         if current.next:
           lowerCAmelCase__								=			current.next
         else:  # We have reached the end an no value matches
           raise ValueError('''No data matching given value'''	)

       if current == self.head:
         self.delete_head()

       elif current == self.tail:
         self.delete_tail()

       else:  # Before: 1 <--> 2(current) <--> 3
         lowerCAmelCase__								=			current.next  # 1 --> 3
         lowerCAmelCase__								=			current.previous  # 1 <--> 3
       return data



     def 					A__			(	self  :		List[str]	):



       """simple docstring"""
       return len(self	) == 0



def 		a_       (   ):

  '''simple docstring'''





  lowerCAmelCase__								=			DoublyLinkedList()
  assert linked_list.is_empty() is True
  assert str(a_							) == ""

  try:
    linked_list.delete_head()
    raise AssertionError  # This should not happen.
  except IndexError:
    assert True  # This should happen.

  try:
    linked_list.delete_tail()
    raise AssertionError  # This should not happen.
  except IndexError:
    assert True  # This should happen.

  for i in range(10							):
    assert len(a_							) == i
    linked_list.insert_at_nth(a_      ,   i + 1							)
  assert str(a_							) == "->".join(str(a_							) for i in range(1      ,   11							)							)

  linked_list.insert_at_head(0							)
  linked_list.insert_at_tail(11							)
  assert str(a_							) == "->".join(str(a_							) for i in range(0      ,   12							)							)

  assert linked_list.delete_head() == 0
  assert linked_list.delete_at_nth(9							) == 10
  assert linked_list.delete_tail() == 11
  assert len(a_							) == 9
  assert str(a_							) == "->".join(str(a_							) for i in range(1      ,   10							)							)


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

      testmod()







def 		a_       (   __lowerCAmelCase      ,   __lowerCAmelCase							):
  assert isinstance(__lowerCAmelCase      ,   __lowerCAmelCase							), F"""The input value of [set_a={set_a}] is not a set"""
  assert isinstance(__lowerCAmelCase      ,   __lowerCAmelCase							), F"""The input value of [set_b={set_b}] is not a set"""

  return {a + b for a in set_a for b in set_b}


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

      testmod()

