"""simple docstring"""




from __future__ import annotations

from typing import Any
class 		__A							:






     def __init__(	self       ,  a__ = 6						):
       _lowerCAmelCase		: Node | None						    =  None
       _lowerCAmelCase		: Node | None						    =  None
       self.create_linked_list(a__						)






     def 					__A						(	self       ,  a__						):
       _lowerCAmelCase		: List[Any]						    =  Node()
       _lowerCAmelCase		: Any						    =  current_node
       _lowerCAmelCase		: Optional[Any]						    =  current_node
       _lowerCAmelCase		: Any						    =  current_node
       for _ in range(1       ,  a__						):
         _lowerCAmelCase		: Dict						    =  Node()
         _lowerCAmelCase		: Union[str, Any]						    =  current_node
         _lowerCAmelCase		: Optional[Any]						    =  previous_node
         _lowerCAmelCase		: Optional[Any]						    =  current_node
       _lowerCAmelCase		: List[str]						    =  self.front
       _lowerCAmelCase		: Dict						    =  previous_node






     def 					__A						(	self						):
       return (
           self.front == self.rear
           and self.front is not None
           and self.front.data is None
       )






     def 					__A						(	self						):
       self.check_can_perform_operation()
       return self.front.data if self.front else None






     def 					__A						(	self       ,  a__						):
       if self.rear is None:
         return

       self.check_is_full()
       if not self.is_empty():
         _lowerCAmelCase		: Dict						    =  self.rear.next
       if self.rear:
         _lowerCAmelCase		: int						    =  data






     def 					__A						(	self						):
       self.check_can_perform_operation()
       if self.rear is None or self.front is None:
         return None
       if self.front == self.rear:
         _lowerCAmelCase		: Tuple						    =  self.front.data
         _lowerCAmelCase		: Tuple						    =  None
         return data

       _lowerCAmelCase		: Optional[int]						    =  self.front
       _lowerCAmelCase		: List[Any]						    =  old_front.next
       _lowerCAmelCase		: int						    =  old_front.data
       _lowerCAmelCase		: Dict						    =  None
       return data






     def 					__A						(	self						):
       if self.is_empty():
         raise Exception("""Empty Queue"""						)






     def 					__A						(	self						):
       if self.rear and self.rear.next == self.front:
         raise Exception("""Full Queue"""						)







class 		__A							:






     def __init__(	self						):
       _lowerCAmelCase		: Any | None						    =  None
       _lowerCAmelCase		: Node | None						    =  None
       _lowerCAmelCase		: Node | None						    =  None


if __name__ == "__main__":
     import doctest

     doctest.testmod()





"""simple docstring"""




class 		__A							(				SCREAMING_SNAKE_CASE_	):
     pass







class 		__A							(				SCREAMING_SNAKE_CASE_	):
     pass







class 		__A							:






     def __init__(	self						):
       _lowerCAmelCase		: Union[str, Any]						    =  [
           [],
           [],
           [],
       ]






     def 					__A						(	self       ,  a__       ,  a__						):
       try:
         if len(self.queues[priority]						) >= 100:
           raise OverflowError("""Maximum queue size is 100"""						)
         self.queues[priority].append(a__						)
       except IndexError:
         raise ValueError("""Valid priorities are 0, 1, and 2"""						)






     def 					__A						(	self						):
       for queue in self.queues:
         if queue:
           return queue.pop(0						)
       raise UnderFlowError("""All queues are empty"""						)






     def __str__(	self						):
       return "\n".join(F"Priority {i}: {q}" for i, q in enumerate(self.queues						)						)







class 		__A							:






     def __init__(	self						):
       _lowerCAmelCase		: int						    =  []






     def 					__A						(	self       ,  a__						):
       if len(self.queue						) == 100:
         raise OverFlowError("""Maximum queue size is 100"""						)
       self.queue.append(a__						)






     def 					__A						(	self						):
       if not self.queue:
         raise UnderFlowError("""The queue is empty"""						)
       else:
         _lowerCAmelCase		: int						    =  min(self.queue						)
         self.queue.remove(a__						)
         return data






     def __str__(	self						):
       return str(self.queue						)







def 							SCREAMING_SNAKE_CASE  (    ) ->   str:
  _lowerCAmelCase		: Union[str, Any]						    =  FixedPriorityQueue()
  fpq.enqueue(0    ,10			)
  fpq.enqueue(1    ,70			)
  fpq.enqueue(0    ,100			)
  fpq.enqueue(2    ,1			)
  fpq.enqueue(2    ,5			)
  fpq.enqueue(1    ,7			)
  fpq.enqueue(2    ,4			)
  fpq.enqueue(1    ,64			)
  fpq.enqueue(0    ,128			)
  print(_lowerCamelCase			)
  print(fpq.dequeue()			)
  print(fpq.dequeue()			)
  print(fpq.dequeue()			)
  print(fpq.dequeue()			)
  print(fpq.dequeue()			)
  print(_lowerCamelCase			)
  print(fpq.dequeue()			)
  print(fpq.dequeue()			)
  print(fpq.dequeue()			)
  print(fpq.dequeue()			)
  print(fpq.dequeue()			)





def 							SCREAMING_SNAKE_CASE  (    ) ->   Union[str, Any]:
  _lowerCAmelCase		: Tuple						    =  ElementPriorityQueue()
  epq.enqueue(10			)
  epq.enqueue(70			)
  epq.enqueue(100			)
  epq.enqueue(1			)
  epq.enqueue(5			)
  epq.enqueue(7			)
  epq.enqueue(4			)
  epq.enqueue(64			)
  epq.enqueue(128			)
  print(_lowerCamelCase			)
  print(epq.dequeue()			)
  print(epq.dequeue()			)
  print(epq.dequeue()			)
  print(epq.dequeue()			)
  print(epq.dequeue()			)
  print(_lowerCamelCase			)
  print(epq.dequeue()			)
  print(epq.dequeue()			)
  print(epq.dequeue()			)
  print(epq.dequeue()			)
  print(epq.dequeue()			)


if __name__ == "__main__":
     fixed_priority_queue()
     element_priority_queue()




