





"""simple docstring"""





from __future__ import annotations

from collections.abc import Iterator
from typing import Any

class 		lowercase					:





      def __init__(       self      ,						lowercase )		->     Any:
            lowerCAmelCase  						=       data
            lowerCAmelCase  						=       None







class 		lowercase					:





      def __init__(       self )		->     str:
            lowerCAmelCase  						=       None
            lowerCAmelCase  						=       None





      def __iter__(       self )		->     Iterator[Any]:
            lowerCAmelCase  						=       self.head
            while self.head:
                  yield node.data
                  lowerCAmelCase  						=       node.next
                  if node == self.head:
                        break





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





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





      def     _snake_case			(       self      ,						lowercase )		->     None:
            self.insert_nth(len(self )      ,						__a )





      def     _snake_case			(       self      ,						lowercase )		->     None:
            self.insert_nth(0      ,						__a )





      def     _snake_case			(       self      ,						lowercase      ,						lowercase )		->     None:

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





      def     _snake_case			(       self )		->     Dict:
            return self.delete_nth(0 )





      def     _snake_case			(       self )		->     Any:
            return self.delete_nth(len(self ) - 1 )





      def     _snake_case			(       self      ,						lowercase = 0 )		->     Any:

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





      def     _snake_case			(       self )		->     bool:
            return len(self ) == 0







def 			UpperCAmelCase__							(  ):







      '''simple docstring'''




      lowerCAmelCase  						=       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()