






import os
import string
import sys


_SCREAMING_SNAKE_CASE   =  1 << 8

_SCREAMING_SNAKE_CASE   =  {
    """tab""": ord("\t"),
    """newline""": ord("\r"),
    """esc""": 27,
    """up""": 65 + ARROW_KEY_FLAG,
    """down""": 66 + ARROW_KEY_FLAG,
    """right""": 67 + ARROW_KEY_FLAG,
    """left""": 68 + ARROW_KEY_FLAG,
    """mod_int""": 91,
    """undefined""": sys.maxsize,
    """interrupt""": 3,
    """insert""": 50,
    """delete""": 51,
    """pg_up""": 53,
    """pg_down""": 54,
}

_SCREAMING_SNAKE_CASE   =  KEYMAP["""up"""]
_SCREAMING_SNAKE_CASE   =  KEYMAP["""left"""]

if sys.platform == "win32":
    _SCREAMING_SNAKE_CASE   =  []
    _SCREAMING_SNAKE_CASE   =  {
        B"""\xe0H""": KEYMAP["""up"""] - ARROW_KEY_FLAG,
        B"""\x00H""": KEYMAP["""up"""] - ARROW_KEY_FLAG,
        B"""\xe0P""": KEYMAP["""down"""] - ARROW_KEY_FLAG,
        B"""\x00P""": KEYMAP["""down"""] - ARROW_KEY_FLAG,
        B"""\xe0M""": KEYMAP["""right"""] - ARROW_KEY_FLAG,
        B"""\x00M""": KEYMAP["""right"""] - ARROW_KEY_FLAG,
        B"""\xe0K""": KEYMAP["""left"""] - ARROW_KEY_FLAG,
        B"""\x00K""": KEYMAP["""left"""] - ARROW_KEY_FLAG,
    }

for i in range(10):
    _SCREAMING_SNAKE_CASE   =  ord(str(i))





def        _snake_case   ()					->	int:
   if os.name == "nt":
      import msvcrt

      _lowercase              ='mbcs'
      # Flush the keyboard buffer
      while msvcrt.kbhit():
         msvcrt.getch()
      if len(UpperCAmelCase_) == 0:
         # Read the keystroke
         _lowercase              =msvcrt.getch()

         # If it is a prefix char, get second part
         if ch in (b"\x00", b"\xe0"):
            _lowercase              =ch + msvcrt.getch()
            # Translate actual Win chars to bullet char types
            try:
               _lowercase              =chr(WIN_KEYMAP[cha])
               WIN_CH_BUFFER.append(chr(KEYMAP['mod_int']))
               WIN_CH_BUFFER.append(UpperCAmelCase_)
               if ord(UpperCAmelCase_) in (
                   KEYMAP["insert"] - 1 << 9,
                   KEYMAP["delete"] - 1 << 9,
                   KEYMAP["pg_up"] - 1 << 9,
                   KEYMAP["pg_down"] - 1 << 9,
               ):
                  WIN_CH_BUFFER.append(chr(126))
               _lowercase              =chr(KEYMAP['esc'])
            except KeyError:
               _lowercase              =cha[1]
         else:
            _lowercase              =ch.decode(UpperCAmelCase_)
      else:
         _lowercase              =WIN_CH_BUFFER.pop(0)
   elif os.name == "posix":
      import termios
      import tty

      _lowercase              =sys.stdin.fileno()
      _lowercase              =termios.tcgetattr(UpperCAmelCase_)
      try:
         tty.setraw(UpperCAmelCase_)
         _lowercase              =sys.stdin.read(1)
      finally:
         termios.tcsetattr(UpperCAmelCase_      ,    termios.TCSADRAIN      ,    UpperCAmelCase_)
   return ch





def        _snake_case   ()					->	List[str]:
   _lowercase              =get_raw_chars()
   if ord(UpperCAmelCase_) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
      return char

   elif ord(UpperCAmelCase_) == KEYMAP["esc"]:
      _lowercase              =get_raw_chars()
      if ord(UpperCAmelCase_) == KEYMAP["mod_int"]:
         _lowercase              =get_raw_chars()
         if ord(UpperCAmelCase_) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(UpperCAmelCase_) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
            return chr(ord(UpperCAmelCase_) + ARROW_KEY_FLAG)
         else:
            return KEYMAP["undefined"]
      else:
         return get_raw_chars()

   else:
      if char in string.printable:
         return char
      else:
         return KEYMAP["undefined"]






'''simple docstring'''



# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


A__						:   Any				=    re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""")





@total_ordering
@dataclass
class   UpperCAmelCase_    :





    """simple docstring"""






    lowerCamelCase    :   str
    lowerCamelCase    :   Optional[str]					=     None
    lowerCamelCase    :   Optional[Union[str, int]]					=     None
    lowerCamelCase    :   Optional[Union[str, int]]					=     None
    lowerCamelCase    :   Optional[Union[str, int]]					=     None







    def  lowercase_							(				self      )							->	List[str]:
         __lowerCamelCase							,			__lowerCamelCase							,			__lowerCamelCase  :      List[Any]														=						_str_to_version_tuple(self.version_str      )







    def __repr__(				self      )							->	Any:
         return f'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'







    @property
    def  lowercase_							(				self      )							->	int:
         return self.major, self.minor, self.patch







    def  lowercase_							(				self     ,	SCREAMING_SNAKE_CASE_      )							->	List[Any]:
         if isinstance(SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_      ):
              return Version(SCREAMING_SNAKE_CASE_      )
         elif isinstance(SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_      ):
              return other
         raise TypeError(f'{other} (type {type(SCREAMING_SNAKE_CASE_      )}) cannot be compared to version.'      )







    def __eq__(				self     ,	SCREAMING_SNAKE_CASE_      )							->	Optional[Any]:
         try:
              __lowerCamelCase  :      Union[str, Any]														=						self._validate_operand(SCREAMING_SNAKE_CASE_      )
         except (TypeError, ValueError):
              return False
         else:
              return self.tuple == other.tuple







    def __lt__(				self     ,	SCREAMING_SNAKE_CASE_      )							->	List[Any]:
         __lowerCamelCase  :      List[Any]														=						self._validate_operand(SCREAMING_SNAKE_CASE_      )
         return self.tuple < other.tuple







    def __hash__(				self      )							->	List[str]:
         return hash(_version_tuple_to_str(self.tuple      )      )







    @classmethod
    def  lowercase_							(				cls     ,	SCREAMING_SNAKE_CASE_      )							->	List[str]:
         __lowerCamelCase  :      str														=						{f.name for f in dataclasses.fields(cls      )}
         return cls(**{k: v for k, v in dic.items() if k in field_names}      )







    def  lowercase_							(				self      )							->	str:
         return self.version_str







def      UpperCAmelCase__   (      UpperCAmelCase_       :							Union[str, Any]				)	->						str:
     __lowerCamelCase  :      str														=						_VERSION_REG.match(UpperCAmelCase_				)
     if not res:
          raise ValueError(F'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'				)
     return tuple(int(UpperCAmelCase_				) for v in [res.group('major'				), res.group('minor'				), res.group('patch'				)]				)



def      UpperCAmelCase__   (      UpperCAmelCase_       :							List[str]				)	->						Dict:
     return ".".join(str(UpperCAmelCase_				) for v in version_tuple				)






