'''simple docstring'''


from __future__ import annotations

from collections.abc import Iterator
from typing import Any






class 					__SCREAMING_SNAKE_CASE						:







  '''simple docstring'''






  def __init__(			self				,		snake_case_						):




       '''simple docstring'''

       UpperCAmelCase_							:       Any       =				data
       UpperCAmelCase_							:       Node | None       =				None







class 					__SCREAMING_SNAKE_CASE						:







  '''simple docstring'''






  def __init__(			self						):




       '''simple docstring'''

       UpperCAmelCase_							:       List[Any]       =				None
       UpperCAmelCase_							:       Optional[Any]       =				None


  def __iter__(			self						):




       '''simple docstring'''

       UpperCAmelCase_							:       int       =				self.head
       while self.head:
            yield node.data
            UpperCAmelCase_							:       List[str]       =				node.next
            if node == self.head:
                 break


  def __len__(			self						):




       '''simple docstring'''

       return sum(1 for _ in self						)


  def __repr__(			self						):




       '''simple docstring'''

       return "->".join(str(SCREAMING_SNAKE_CASE_						) for item in iter(self						)						)


  def _UpperCamelCase					(			self				,		snake_case_						):




       '''simple docstring'''

       self.insert_nth(len(self						)				,		SCREAMING_SNAKE_CASE_						)


  def _UpperCamelCase					(			self				,		snake_case_						):




       '''simple docstring'''

       self.insert_nth(0				,		SCREAMING_SNAKE_CASE_						)


  def _UpperCamelCase					(			self				,		snake_case_				,		snake_case_						):




       '''simple docstring'''

       if index < 0 or index > len(self						):
            raise IndexError('list index out of range.'						)
       UpperCAmelCase_							:       Any       =				Node(SCREAMING_SNAKE_CASE_						)
       if self.head is None:
            UpperCAmelCase_							:       Tuple       =				new_node  # first node points itself
            UpperCAmelCase_							:       Union[str, Any]       =				new_node
       elif index == 0:  # insert at head
            UpperCAmelCase_							:       str       =				self.head
            UpperCAmelCase_							:       int       =				new_node
       else:
            UpperCAmelCase_							:       Optional[int]       =				self.head
            for _ in range(index - 1						):
                 UpperCAmelCase_							:       Optional[Any]       =				temp.next
            UpperCAmelCase_							:       Optional[int]       =				temp.next
            UpperCAmelCase_							:       Optional[Any]       =				new_node
            if index == len(self						) - 1:  # insert at tail
                 UpperCAmelCase_							:       List[str]       =				new_node


  def _UpperCamelCase					(			self						):




       '''simple docstring'''

       return self.delete_nth(0						)


  def _UpperCamelCase					(			self						):




       '''simple docstring'''

       return self.delete_nth(len(self						) - 1						)


  def _UpperCamelCase					(			self				,		snake_case_ = 0						):




       '''simple docstring'''

       if not 0 <= index < len(self						):
            raise IndexError('list index out of range.'						)
       UpperCAmelCase_							:       Optional[int]       =				self.head
       if self.head == self.tail:  # just one node
            UpperCAmelCase_							:       int       =				None
       elif index == 0:  # delete head node
            UpperCAmelCase_							:       Optional[Any]       =				self.tail.next.next
            UpperCAmelCase_							:       Dict       =				self.head.next
       else:
            UpperCAmelCase_							:       str       =				self.head
            for _ in range(index - 1						):
                 UpperCAmelCase_							:       Dict       =				temp.next
            UpperCAmelCase_							:       Any       =				temp.next
            UpperCAmelCase_							:       Dict       =				temp.next.next
            if index == len(self						) - 1:  # delete at tail
                 UpperCAmelCase_							:       Dict       =				temp
       return delete_node.data






  def _UpperCamelCase					(			self						):




       '''simple docstring'''

       return len(self						) == 0







def  _lowerCamelCase   (				):



     """simple docstring"""





     UpperCAmelCase_							:       Optional[int]       =				CircularLinkedList()
     assert len(snake_case__       ) == 0
     assert circular_linked_list.is_empty() is True
     assert str(snake_case__       ) == ""

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

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

     try:
          circular_linked_list.delete_nth(-1       )
          raise AssertionError
     except IndexError:
          assert True

     try:
          circular_linked_list.delete_nth(0       )
          raise AssertionError
     except IndexError:
          assert True

     assert circular_linked_list.is_empty() is True
     for i in range(5       ):
          assert len(snake_case__       ) == i
          circular_linked_list.insert_nth(snake_case__     ,					i + 1       )
     assert str(snake_case__       ) == "->".join(str(snake_case__       ) for i in range(1     ,					6       )       )

     circular_linked_list.insert_tail(6       )
     assert str(snake_case__       ) == "->".join(str(snake_case__       ) for i in range(1     ,					7       )       )
     circular_linked_list.insert_head(0       )
     assert str(snake_case__       ) == "->".join(str(snake_case__       ) for i in range(0     ,					7       )       )

     assert circular_linked_list.delete_front() == 0
     assert circular_linked_list.delete_tail() == 6
     assert str(snake_case__       ) == "->".join(str(snake_case__       ) for i in range(1     ,					6       )       )
     assert circular_linked_list.delete_nth(2       ) == 3

     circular_linked_list.insert_nth(2     ,					3       )
     assert str(snake_case__       ) == "->".join(str(snake_case__       ) for i in range(1     ,					6       )       )

     assert circular_linked_list.is_empty() is False


if __name__ == "__main__":
 import doctest

 doctest.testmod()



'''simple docstring'''


snake_case__					:      Optional[Any]				      =  tuple[float, float, float]
snake_case__					:      Tuple				      =  tuple[float, float, float]


def  _lowerCamelCase   (				lowerCamelCase_ :							Pointad     ,					lowerCamelCase_ :							Pointad       ):



     """simple docstring"""





     UpperCAmelCase_							:       Any       =				end_pointa[0] - end_pointa[0]
     UpperCAmelCase_							:       Optional[Any]       =				end_pointa[1] - end_pointa[1]
     UpperCAmelCase_							:       Any       =				end_pointa[2] - end_pointa[2]
     return (x, y, z)


def  _lowerCamelCase   (				lowerCamelCase_ :							Vectorad     ,					lowerCamelCase_ :							Vectorad       ):



     """simple docstring"""





     UpperCAmelCase_							:       Optional[Any]       =				ab[1] * ac[2] - ab[2] * ac[1]  # *i
     UpperCAmelCase_							:       Optional[Any]       =				(ab[0] * ac[2] - ab[2] * ac[0]) * -1  # *j
     UpperCAmelCase_							:       Dict       =				ab[0] * ac[1] - ab[1] * ac[0]  # *k
     return (x, y, z)


def  _lowerCamelCase   (				lowerCamelCase_ :							Vectorad     ,					lowerCamelCase_ :							int       ):



     """simple docstring"""





     return tuple(round(lowerCamelCase_     ,					lowerCamelCase_       ) for x in vector       ) == (0, 0, 0)





def  _lowerCamelCase   (				lowerCamelCase_ :							Pointad     ,					lowerCamelCase_ :							Pointad     ,					lowerCamelCase_ :							Pointad     ,					lowerCamelCase_ :							int = 10       ):



     """simple docstring"""





     UpperCAmelCase_							:       List[str]       =				create_vector(lowerCamelCase_     ,					lowerCamelCase_       )
     UpperCAmelCase_							:       List[Any]       =				create_vector(lowerCamelCase_     ,					lowerCamelCase_       )
     return is_zero_vector(get_ad_vectors_cross(lowerCamelCase_     ,					lowerCamelCase_       )     ,					lowerCamelCase_       )






