




from __future__ import annotations

import sys
from collections import deque
from typing import Generic, TypeVar

snake_case_ : Union[str, Any]    		=       TypeVar("T")







class __snake_case			(			Generic[T]		):
   UpperCAmelCase__  :    deque[T]  # Cache store of keys
   UpperCAmelCase__  :    set[T]  # References of the keys in cache
   UpperCAmelCase__  :    int          =  1_0  # Maximum capacity of cache







   def __init__(      self		:						Optional[int]					,						_snake_case		:						int):

        """simple docstring"""


        UpperCAmelCase_          =							deque()
        UpperCAmelCase_          =							set()
        if not n:
             UpperCAmelCase_          =							sys.maxsize
        elif n < 0:
             raise ValueError('''n should be an integer greater than 0.''')
        else:
             UpperCAmelCase_          =							n







   def lowerCamelCase						(      self		:						int					,						_snake_case		:						T):

        """simple docstring"""


        if x not in self.key_reference:
             if len(self.dq_store) == LRUCache._MAX_CAPACITY:
                  UpperCAmelCase_          =							self.dq_store.pop()
                  self.key_reference.remove(_snake_case)
        else:
             self.dq_store.remove(_snake_case)

        self.dq_store.appendleft(_snake_case)
        self.key_reference.add(_snake_case)







   def lowerCamelCase						(      self		:						Any):

        """simple docstring"""


        for k in self.dq_store:
             print(_snake_case)







   def __repr__(      self		:						Optional[Any]):

        """simple docstring"""


        return F"""LRUCache({self._MAX_CAPACITY}) => {list(self.dq_store)}"""


if __name__ == "__main__":
    import doctest

    doctest.testmod()

    snake_case_ : LRUCache[str | int]    		=       LRUCache(4)
    lru_cache.refer("A")
    lru_cache.refer(2)
    lru_cache.refer(3)
    lru_cache.refer("A")
    lru_cache.refer(4)
    lru_cache.refer(5)
    lru_cache.display()

    print(lru_cache)
    assert str(lru_cache) == "LRUCache(4) => [5, 4, 'A', 3]"









def   __SCREAMING_SNAKE_CASE					(SCREAMING_SNAKE_CASE__       ):
						snake_case_   =	[]
						if len(SCREAMING_SNAKE_CASE__       ) == 1:
												return [nums.copy()]
						for _ in range(len(SCREAMING_SNAKE_CASE__       )       ):
												snake_case_   =	nums.pop(0       )
												snake_case_   =	permute(SCREAMING_SNAKE_CASE__       )
												for perm in permutations:
																		perm.append(SCREAMING_SNAKE_CASE__       )
												result.extend(SCREAMING_SNAKE_CASE__       )
												nums.append(SCREAMING_SNAKE_CASE__       )
						return result


def   __SCREAMING_SNAKE_CASE					(SCREAMING_SNAKE_CASE__       ):

						def backtrack(SCREAMING_SNAKE_CASE__       ):
												if start == len(SCREAMING_SNAKE_CASE__       ) - 1:
																		output.append(nums[:]       )
												else:
																		for i in range(SCREAMING_SNAKE_CASE__  ,		len(SCREAMING_SNAKE_CASE__       )       ):
																								snake_case_,    snake_case_   =	nums[i], nums[start]
																								backtrack(start + 1       )
																								snake_case_,    snake_case_   =	nums[i], nums[start]  # backtrack

						snake_case_   =	[]
						backtrack(0       )
						return output


if __name__ == "__main__":
					import doctest

					# use res to print the data in permute2 function
					lowerCAmelCase_       	=	permutea([1, 2, 3])
					print(res)
					doctest.testmod()