






from __future__ import annotations

from collections.abc import Iterator
from typing import Any

class 						lowerCAmelCase   :

					'''simple docstring'''

					def __init__(     self :		List[Any]						,   __a :		Any							)	->     Any:


												"""simple docstring"""

												__lowercase					:							Any			=   data
												__lowercase					:							Node | None			=   None







class 						lowerCAmelCase   :

					'''simple docstring'''

					def __init__(     self :		Dict							)	->     str:


												"""simple docstring"""

												__lowercase					:							Dict			=   None
												__lowercase					:							Dict			=   None



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


												"""simple docstring"""

												__lowercase					:							Tuple			=   self.head
												while self.head:
																			yield node.data
																			__lowercase					:							Dict			=   node.next
																			if node == self.head:
																										break



					def __len__(     self :		str							)	->     int:


												"""simple docstring"""

												return sum(1 for _ in self							)



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


												"""simple docstring"""

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



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


												"""simple docstring"""

												self.insert_nth(len(self							)						,   __a							)



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


												"""simple docstring"""

												self.insert_nth(0						,   __a							)



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


												"""simple docstring"""

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



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


												"""simple docstring"""

												return self.delete_nth(0							)



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


												"""simple docstring"""

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



					def 					lowerCAmelCase (     self :		int						,   __a :		int = 0							)	->     Any:


												"""simple docstring"""

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



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


												"""simple docstring"""

												return len(self							) == 0







def 					snake_case_						(   ):
							__lowercase					:							Optional[int]			=   CircularLinkedList()
							assert len(lowerCAmelCase_					) == 0
							assert circular_linked_list.is_empty() is True
							assert str(lowerCAmelCase_					) == ""

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

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

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

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

							assert circular_linked_list.is_empty() is False


if __name__ == "__main__":
	import doctest

	doctest.testmod()







from maths.prime_check import is_prime
def 					snake_case_						(   lowerCAmelCase_				:  int					):
							if not isinstance(lowerCAmelCase_				,				lowerCAmelCase_					):
														__lowercase					:							Dict			=   F"Input value of [number={number}] must be an integer"
														raise TypeError(lowerCAmelCase_					)
							if is_prime(lowerCAmelCase_					) and is_prime(number + 2					):
														return number + 2
							else:
														return -1


if __name__ == "__main__":
	import doctest

	doctest.testmod()