



'''simple docstring'''






from __future__ import annotations

from collections.abc import Iterator
from typing import Any

class 							a__:







    def __init__(				self			:  List[Any]						,      __snake_case			:  Any     ):
      a						: Any					       =					data
      a						: Node | None					       =					None

class 							a__:







    def __init__(				self			:  Union[str, Any]     ):
      a						: List[str]					       =					None
      a						: Optional[Any]					       =					None







    def __iter__(				self			:  int     ):
      a						: Optional[int]					       =					self.head
      while self.head:
        yield node.data
        a						: List[Any]					       =					node.next
        if node == self.head:
          break







    def __len__(				self			:  Tuple     ):
      return sum(1 for _ in self     )







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







    def       lowercase_	(				self			:  Union[str, Any]						,      __snake_case			:  Any     ):
      self.insert_nth(len(self     )						,      __snake_case     )







    def       lowercase_	(				self			:  Any						,      __snake_case			:  Any     ):
      self.insert_nth(0						,      __snake_case     )







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







    def       lowercase_	(				self			:  Dict     ):
      return self.delete_nth(0     )







    def       lowercase_	(				self			:  Dict     ):
      return self.delete_nth(len(self     ) - 1     )







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







    def       lowercase_	(				self			:  Optional[int]     ):
      return len(self     ) == 0
def 				lowerCamelCase__	(						):
  a						: Union[str, Any]					       =					CircularLinkedList()
  assert len(_A    ) == 0
  assert circular_linked_list.is_empty() is True
  assert str(_A    ) == ""

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

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

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

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

  assert circular_linked_list.is_empty() is False


if __name__ == "__main__":
     import doctest

     doctest.testmod()




'''simple docstring'''






lowerCAmelCase: Union[str, Any]							=						{
    'meter': 'm',
    'kilometer': 'km',
    'megametre': 'Mm',
    'gigametre': 'Gm',
    'terametre': 'Tm',
    'petametre': 'Pm',
    'exametre': 'Em',
    'zettametre': 'Zm',
    'yottametre': 'Ym',
}
# Exponent of the factor(meter)
lowerCAmelCase: Optional[Any]							=						{
    'm': 0,
    'km': 3,
    'Mm': 6,
    'Gm': 9,
    'Tm': 1_2,
    'Pm': 1_5,
    'Em': 1_8,
    'Zm': 2_1,
    'Ym': 2_4,
}
def 				lowerCamelCase__	(						_A			,      _A			,      _A    ):
  a						: Optional[int]					       =					from_type.lower().strip('s'    )
  a						: Optional[Any]					       =					to_type.lower().strip('s'    )

  a						: Dict					       =					UNIT_SYMBOL.get(_A			,      _A    )
  a						: Optional[Any]					       =					UNIT_SYMBOL.get(_A			,      _A    )

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

  if from_exponent > to_exponent:
    a						: Optional[int]					       =					from_exponent - to_exponent
  else:
    a						: Optional[Any]					       =					-(to_exponent - from_exponent)

  return value * pow(10			,      _A    )


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

     testmod()