



from typing import List

from .keymap import KEYMAP, get_character


def 	UpperCAmelCase__      (      UpperCAmelCase__ :str					):






 '''simple docstring'''

 def decorator(UpperCAmelCase__ :Any					):
  a						=		getattr(UpperCAmelCase__ ,					"handle_key" ,					[]					)
  handle += [key]
  setattr(UpperCAmelCase__ ,					"handle_key" ,					UpperCAmelCase__					)
  return func

 return decorator


def 	UpperCAmelCase__      (      *UpperCAmelCase__ :List[str]					):






 '''simple docstring'''

 def decorator(UpperCAmelCase__ :str					):
  a						=		getattr(UpperCAmelCase__ ,					"handle_key" ,					[]					)
  handle += keys
  setattr(UpperCAmelCase__ ,					"handle_key" ,					UpperCAmelCase__					)
  return func

 return decorator



class 		_lowercase		(       UpperCAmelCase__	):

   def __new__(      cls			:       Dict							,   __lowerCAmelCase			:       List[str]							,   __lowerCAmelCase			:       Tuple							,   __lowerCAmelCase			:       int							)       ->				Optional[Any]:


    """simple docstring"""






    a						=		super().__new__(cls							,   __lowerCAmelCase							,   __lowerCAmelCase							,   __lowerCAmelCase							)
    if not hasattr(__lowerCAmelCase							,   "key_handler"							):
     setattr(__lowerCAmelCase							,   "key_handler"							,   {}							)
    setattr(__lowerCAmelCase							,   "handle_input"							,   KeyHandler.handle_input							)

    for value in attrs.values():
     a						=		getattr(__lowerCAmelCase							,   "handle_key"							,   []							)
     for key in handled_keys:
      a						=		value
    return new_cls




   @staticmethod
   def 		A							(      cls			:       int							)       ->				Optional[Any]:


    """simple docstring"""






    a						=		get_character()
    if char != KEYMAP["undefined"]:
     a						=		ord(__lowerCAmelCase							)
    a						=		cls.key_handler.get(__lowerCAmelCase							)
    if handler:
     a						=		char
     return handler(cls							)
    else:
     return None


def 	UpperCAmelCase__      (      cls :Tuple					):






 '''simple docstring'''

 return KeyHandler(cls.__name__ ,					cls.__bases__ ,					cls.__dict__.copy()					)






from __future__ import annotations


def 	UpperCAmelCase__      (      UpperCAmelCase__ :int					):






 '''simple docstring'''

 a						=		str(UpperCAmelCase__					)
 return len(UpperCAmelCase__					) == 9 and set(UpperCAmelCase__					) == set("123456789"					)


def 	UpperCAmelCase__      (      ):






 '''simple docstring'''

 for base_num in range(99_99 ,					49_99 ,					-1					):
  a						=		10_00_02 * base_num
  if is_9_pandigital(UpperCAmelCase__					):
   return candidate

 for base_num in range(3_33 ,					99 ,					-1					):
  a						=		1_00_20_03 * base_num
  if is_9_pandigital(UpperCAmelCase__					):
   return candidate

 return None


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

