


"""simple docstring"""
from __future__ import annotations

from collections.abc import Iterator
from typing import Any





class        __A       :





							'''simple docstring'''

							def __init__(			self							: Tuple						,    UpperCAmelCase_							: Any    )   ->Optional[Any]:



														"""simple docstring"""



														snake_case_          =						data
														snake_case_          =						None





class        __A       :





							'''simple docstring'''

							def __init__(			self							: Optional[Any]    )   ->Optional[Any]:



														"""simple docstring"""



														snake_case_          =						None
														snake_case_          =						None



							def __iter__(			self							: Optional[int]    )   ->Iterator[Any]:



														"""simple docstring"""



														snake_case_          =						self.head
														while self.head:
																					yield node.data
																					snake_case_          =						node.next
																					if node == self.head:
																												break



							def __len__(			self							: str    )   ->int:



														"""simple docstring"""



														return sum(1 for _ in self    )



							def __repr__(			self							: Union[str, Any]    )   ->int:



														"""simple docstring"""



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



							def 						lowerCAmelCase    (			self							: Union[str, Any]						,    UpperCAmelCase_							: Any    )   ->None:



														"""simple docstring"""



														self.insert_nth(len(self    )						,    UpperCAmelCase_    )



							def 						lowerCAmelCase    (			self							: Optional[int]						,    UpperCAmelCase_							: Any    )   ->None:



														"""simple docstring"""



														self.insert_nth(0						,    UpperCAmelCase_    )



							def 						lowerCAmelCase    (			self							: Any						,    UpperCAmelCase_							: int						,    UpperCAmelCase_							: Any    )   ->None:



														"""simple docstring"""



														if index < 0 or index > len(self    ):
																					raise IndexError("""list index out of range."""    )
														snake_case_          =						Node(UpperCAmelCase_    )
														if self.head is None:
																					snake_case_          =						new_node  # first node points itself
																					snake_case_          =						snake_case_          =						new_node
														elif index == 0:  # insert at head
																					snake_case_          =						self.head
																					snake_case_          =						snake_case_          =						new_node
														else:
																					snake_case_          =						self.head
																					for _ in range(index - 1    ):
																												snake_case_          =						temp.next
																					snake_case_          =						temp.next
																					snake_case_          =						new_node
																					if index == len(self    ) - 1:  # insert at tail
																												snake_case_          =						new_node



							def 						lowerCAmelCase    (			self							: Tuple    )   ->Any:



														"""simple docstring"""



														return self.delete_nth(0    )



							def 						lowerCAmelCase    (			self							: Optional[int]    )   ->Any:



														"""simple docstring"""



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



							def 						lowerCAmelCase    (			self							: Optional[int]						,    UpperCAmelCase_							: int = 0    )   ->Any:



														"""simple docstring"""



														if not 0 <= index < len(self    ):
																					raise IndexError("""list index out of range."""    )
														snake_case_          =						self.head
														if self.head == self.tail:  # just one node
																					snake_case_          =						snake_case_          =						None
														elif index == 0:  # delete head node
																					snake_case_          =						self.tail.next.next
																					snake_case_          =						self.head.next
														else:
																					snake_case_          =						self.head
																					for _ in range(index - 1    ):
																												snake_case_          =						temp.next
																					snake_case_          =						temp.next
																					snake_case_          =						temp.next.next
																					if index == len(self    ) - 1:  # delete at tail
																												snake_case_          =						temp
														return delete_node.data



							def 						lowerCAmelCase    (			self							: Optional[Any]    )   ->bool:



														"""simple docstring"""



														return len(self    ) == 0







def   _a			( )      ->			None:
							snake_case_          =						CircularLinkedList()
							assert len(_SCREAMING_SNAKE_CASE			) == 0
							assert circular_linked_list.is_empty() is True
							assert str(_SCREAMING_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(_SCREAMING_SNAKE_CASE			) == i
														circular_linked_list.insert_nth(_SCREAMING_SNAKE_CASE			,	i + 1			)
							assert str(_SCREAMING_SNAKE_CASE			) == "->".join(str(_SCREAMING_SNAKE_CASE			) for i in range(1			,	6			)			)

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

							assert circular_linked_list.delete_front() == 0
							assert circular_linked_list.delete_tail() == 6
							assert str(_SCREAMING_SNAKE_CASE			) == "->".join(str(_SCREAMING_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(_SCREAMING_SNAKE_CASE			) == "->".join(str(_SCREAMING_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"""
def   _a			( _SCREAMING_SNAKE_CASE			)      ->			int:
							assert column_title.isupper()
							snake_case_          =						0
							snake_case_          =						len(_SCREAMING_SNAKE_CASE			) - 1
							snake_case_          =						0

							while index >= 0:
														snake_case_          =						(ord(column_title[index]			) - 64) * pow(26			,	_SCREAMING_SNAKE_CASE			)
														answer += value
														power += 1
														index -= 1

							return answer


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

				testmod()



