




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

from collections.abc import Iterable
from dataclasses import dataclass
from typing import Any







class  _SCREAMING_SNAKE_CASE       :



 '''simple docstring'''





 __UpperCAmelCase		   =							('''_front''', '''_back''', '''_len''')







 @dataclass
 class  _SCREAMING_SNAKE_CASE       :



  '''simple docstring'''





  __UpperCAmelCase		   =							None
  __UpperCAmelCase		   =							None
  __UpperCAmelCase		   =							None







 class  _SCREAMING_SNAKE_CASE       :



  '''simple docstring'''





  __UpperCAmelCase		   =							('''_cur''',)






  def __init__(self					,     lowerCAmelCase__   ):

   '''simple docstring'''







   _UpperCamelCase      :	List[Any]					      =  cur






  def __iter__(self   ):

   '''simple docstring'''







   return self






  def lowercase_      (self   ):

   '''simple docstring'''







   if self._cur is None:
    # finished iterating
    raise StopIteration
   _UpperCamelCase      :	Optional[int]					      =  self._cur.val
   _UpperCamelCase      :	int					      =  self._cur.next_node

   return val






 def __init__(self					,     lowerCAmelCase__ = None   ):

  '''simple docstring'''







  _UpperCamelCase      :	int					      =  None
  _UpperCamelCase      :	List[Any]					      =  None
  _UpperCamelCase      :	Optional[Any]					      =  0

  if iterable is not None:
   # append every value to the deque
   for val in iterable:
    self.append(lowerCAmelCase__   )






 def lowercase_      (self					,     lowerCAmelCase__   ):

  '''simple docstring'''







  _UpperCamelCase      :	List[Any]					      =  self._Node(lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__   )
  if self.is_empty():
   # front = back
   _UpperCamelCase      :	Dict					      =  node
   _UpperCamelCase      :	Union[str, Any]					      =  1
  else:
   # connect nodes
   _UpperCamelCase      :	Any					      =  node
   _UpperCamelCase      :	Optional[int]					      =  self._back
   _UpperCamelCase      :	Optional[Any]					      =  node  # assign new back to the new node

   self._len += 1

   # make sure there were no errors
   assert not self.is_empty(), "Error on appending value."






 def lowercase_      (self					,     lowerCAmelCase__   ):

  '''simple docstring'''







  _UpperCamelCase      :	Any					      =  self._Node(lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__   )
  if self.is_empty():
   # front = back
   _UpperCamelCase      :	Dict					      =  node
   _UpperCamelCase      :	int					      =  1
  else:
   # connect nodes
   _UpperCamelCase      :	Optional[int]					      =  self._front
   _UpperCamelCase      :	List[str]					      =  node
   _UpperCamelCase      :	Tuple					      =  node  # assign new front to the new node

   self._len += 1

   # make sure there were no errors
   assert not self.is_empty(), "Error on appending value."






 def lowercase_      (self					,     lowerCAmelCase__   ):

  '''simple docstring'''







  for val in iterable:
   self.append(lowerCAmelCase__   )






 def lowercase_      (self					,     lowerCAmelCase__   ):

  '''simple docstring'''







  for val in iterable:
   self.appendleft(lowerCAmelCase__   )






 def lowercase_      (self   ):

  '''simple docstring'''







  assert not self.is_empty(), "Deque is empty."

  _UpperCamelCase      :	List[str]					      =  self._back
  _UpperCamelCase      :	Tuple					      =  self._back.prev_node  # set new back
  # drop the last node - python will deallocate memory automatically
  _UpperCamelCase      :	Union[str, Any]					      =  None

  self._len -= 1

  return topop.val






 def lowercase_      (self   ):

  '''simple docstring'''







  assert not self.is_empty(), "Deque is empty."

  _UpperCamelCase      :	Optional[Any]					      =  self._front
  _UpperCamelCase      :	Any					      =  self._front.next_node  # set new front and drop the first node
  _UpperCamelCase      :	List[Any]					      =  None

  self._len -= 1

  return topop.val






 def lowercase_      (self   ):

  '''simple docstring'''







  return self._front is None






 def __len__(self   ):

  '''simple docstring'''







  return self._len






 def __eq__(self					,     lowerCAmelCase__   ):

  '''simple docstring'''







  if not isinstance(lowerCAmelCase__					,     lowerCAmelCase__   ):
   return NotImplemented

  _UpperCamelCase      :	Any					      =  self._front
  _UpperCamelCase      :	Tuple					      =  other._front

  # if the length of the dequeues are not the same, they are not equal
  if len(self   ) != len(lowerCAmelCase__   ):
   return False

  while me is not None and oth is not None:
   # compare every value
   if me.val != oth.val:
    return False
   _UpperCamelCase      :	Any					      =  me.next_node
   _UpperCamelCase      :	Optional[int]					      =  oth.next_node

  return True






 def __iter__(self   ):

  '''simple docstring'''







  return Deque._Iterator(self._front   )






 def __repr__(self   ):

  '''simple docstring'''







  _UpperCamelCase      :	Optional[int]					      =  []
  _UpperCamelCase      :	Tuple					      =  self._front
  while aux is not None:
   # append the values in a list to display
   values_list.append(aux.val   )
   _UpperCamelCase      :	Union[str, Any]					      =  aux.next_node

  return F"[{', '.join(repr(lowerCAmelCase__   ) for val in values_list   )}]"


if __name__ == "__main__":
    import doctest

    doctest.testmod()





'''simple docstring'''







from collections import defaultdict







def   lowerCAmelCase(  a__    :  int = 5      ):







       '''simple docstring'''






       lowerCamelCase__				   =      defaultdict(a__      )
       lowerCamelCase__				   =      0

       while True:
              lowerCamelCase__				   =      get_digits(a__      )
              freqs[digits].append(a__      )

              if len(freqs[digits]      ) == max_base:
                     lowerCamelCase__				   =      freqs[digits][0] ** 3
                     return base

              num += 1







def   lowerCAmelCase(  a__    :  int      ):







       '''simple docstring'''






       return "".join(sorted(str(num**3      )      )      )


if __name__ == "__main__":
    print(f'{solution() = }')

