


from __future__ import annotations

from collections.abc import Iterator
from typing import Any






class     UpperCAmelCase__       :



    """simple docstring"""






    def __init__(			self					,   A_    )  ->       Dict:
         __UpperCamelCase    							=data
         __UpperCamelCase    							=None






class     UpperCAmelCase__       :



    """simple docstring"""






    def __init__(			self    )  ->       List[str]:
         __UpperCamelCase    							=None
         __UpperCamelCase    							=None






    def __iter__(			self    )  ->       List[str]:
         __UpperCamelCase    							=self.head
         while self.head:
              yield node.data
              __UpperCamelCase    							=node.next
              if node == self.head:
                   break






    def __len__(			self    )  ->       str:
         return sum(1 for _ in self    )






    def __repr__(			self    )  ->       Dict:
         return "->".join(str(A_    ) for item in iter(self    )    )






    def _a					(			self					,   A_    )  ->       Any:
         self.insert_nth(len(self    )					,   A_    )






    def _a					(			self					,   A_    )  ->       Any:
         self.insert_nth(0					,   A_    )






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






    def _a					(			self    )  ->       Optional[int]:
         return self.delete_nth(0    )






    def _a					(			self    )  ->       Optional[int]:
         return self.delete_nth(len(self    ) - 1    )






    def _a					(			self					,   A_ = 0    )  ->       str:
         if not 0 <= index < len(self    ):
              raise IndexError('list index out of range.'    )
         __UpperCamelCase    							=self.head
         if self.head == self.tail:  # just one node
              __UpperCamelCase    							=None
         elif index == 0:  # delete head node
              __UpperCamelCase    							=self.tail.next.next
              __UpperCamelCase    							=self.head.next
         else:
              __UpperCamelCase    							=self.head
              for _ in range(index - 1    ):
                   __UpperCamelCase    							=temp.next
              __UpperCamelCase    							=temp.next
              __UpperCamelCase    							=temp.next.next
              if index == len(self    ) - 1:  # delete at tail
                   __UpperCamelCase    							=temp
         return delete_node.data






    def _a					(			self    )  ->       Union[str, Any]:
         return len(self    ) == 0

def 						_UpperCAmelCase				(			):
     __UpperCamelCase    							=CircularLinkedList()
     assert len(lowercase__				) == 0
     assert circular_linked_list.is_empty() is True
     assert str(lowercase__				) == ""

     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(lowercase__				) == i
          circular_linked_list.insert_nth(lowercase__			,     i + 1				)
     assert str(lowercase__				) == "->".join(str(lowercase__				) for i in range(1			,     6				)				)

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

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

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

     assert circular_linked_list.is_empty() is False


if __name__ == "__main__":
   import doctest

   doctest.testmod()











"""simple docstring"""






lowercase__     						=						{
    """meter""": """m""",
    """kilometer""": """km""",
    """megametre""": """Mm""",
    """gigametre""": """Gm""",
    """terametre""": """Tm""",
    """petametre""": """Pm""",
    """exametre""": """Em""",
    """zettametre""": """Zm""",
    """yottametre""": """Ym""",
}
# Exponent of the factor(meter)
lowercase__     						=						{
    """m""": 0,
    """km""": 3,
    """Mm""": 6,
    """Gm""": 9,
    """Tm""": 12,
    """Pm""": 15,
    """Em""": 18,
    """Zm""": 21,
    """Ym""": 24,
}







def      _snake_case			(				lowercase__							,    lowercase__							,    lowercase__		):
				_lowerCamelCase     :			List[Any]    =    from_type.lower().strip('s'		)
				_lowerCamelCase     :			List[Any]    =    to_type.lower().strip('s'		)

				_lowerCamelCase     :			Optional[int]    =    UNIT_SYMBOL.get(lowercase__							,    lowercase__		)
				_lowerCamelCase     :			Any    =    UNIT_SYMBOL.get(lowercase__							,    lowercase__		)

				if from_sanitized not in METRIC_CONVERSION:
								_lowerCamelCase     :			Tuple    =    (
								    f'''Invalid \'from_type\' value: {from_type!r}.\n'''
								    f'''Conversion abbreviations are: {', '.join(lowercase__		)}'''
								)
								raise ValueError(lowercase__		)
				if to_sanitized not in METRIC_CONVERSION:
								_lowerCamelCase     :			Any    =    (
								    f'''Invalid \'to_type\' value: {to_type!r}.\n'''
								    f'''Conversion abbreviations are: {', '.join(lowercase__		)}'''
								)
								raise ValueError(lowercase__		)
				_lowerCamelCase     :			List[Any]    =    METRIC_CONVERSION[from_sanitized]
				_lowerCamelCase     :			int    =    METRIC_CONVERSION[to_sanitized]
				_lowerCamelCase     :			List[str]    =    1

				if from_exponent > to_exponent:
								_lowerCamelCase     :			List[str]    =    from_exponent - to_exponent
				else:
								_lowerCamelCase     :			List[Any]    =    -(to_exponent - from_exponent)

				return value * pow(10							,    lowercase__		)


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

			testmod()