






'''simple docstring'''







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


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




@total_ordering
@dataclass
class   __SCREAMING_SNAKE_CASE       :


  """simple docstring"""


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







  def    _a       (			self	):






         """simple docstring"""


         a_     ,	a_     ,	a_						     =			_str_to_version_tuple(self.version_str	)







  def __repr__(			self	):






         """simple docstring"""


         return f'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'







  @property
  def    _a       (			self	):






         """simple docstring"""


         return self.major, self.minor, self.patch







  def    _a       (			self   ,	UpperCamelCase__	):






         """simple docstring"""


         if isinstance(UpperCamelCase__   ,	UpperCamelCase__	):
                return Version(UpperCamelCase__	)
         elif isinstance(UpperCamelCase__   ,	UpperCamelCase__	):
                return other
         raise TypeError(f'{other} (type {type(UpperCamelCase__	)}) cannot be compared to version.'	)







  def __eq__(			self   ,	UpperCamelCase__	):






         """simple docstring"""


         try:
                a_						     =			self._validate_operand(UpperCamelCase__	)
         except (TypeError, ValueError):
                return False
         else:
                return self.tuple == other.tuple







  def __lt__(			self   ,	UpperCamelCase__	):






         """simple docstring"""


         a_						     =			self._validate_operand(UpperCamelCase__	)
         return self.tuple < other.tuple







  def __hash__(			self	):






         """simple docstring"""


         return hash(_version_tuple_to_str(self.tuple	)	)







  @classmethod
  def    _a       (			cls   ,	UpperCamelCase__	):






         """simple docstring"""


         a_						     =			{f.name for f in dataclasses.fields(cls	)}
         return cls(**{k: v for k, v in dic.items() if k in field_names}	)







  def    _a       (			self	):






         """simple docstring"""


         return self.version_str





def       __UpperCamelCase					(      lowercase_       :  Tuple   ):
       """simple docstring"""




       a_						     =			_VERSION_REG.match(lowercase_   )
       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(lowercase_   ) for v in [res.group('major'   ), res.group('minor'   ), res.group('patch'   )]   )


def       __UpperCamelCase					(      lowercase_       :  List[Any]   ):
       """simple docstring"""




       return ".".join(str(lowercase_   ) for v in version_tuple   )












'''simple docstring'''







from __future__ import annotations

from collections.abc import Iterator
from typing import Generic, TypeVar

__lowerCAmelCase        =							TypeVar("T")




class   __SCREAMING_SNAKE_CASE       (Generic[T]       ):


  """simple docstring"""


  def __init__(			self   ,	UpperCamelCase__	):






         """simple docstring"""


         a_						     =			data
         a_						     =			None







  def __str__(			self	):






         """simple docstring"""


         return f'{self.data}'





class   __SCREAMING_SNAKE_CASE       (Generic[T]       ):


  """simple docstring"""


  def __init__(			self	):






         """simple docstring"""


         a_						     =			None







  def __iter__(			self	):






         """simple docstring"""


         a_						     =			self.top
         while node:
                yield node.data
                a_						     =			node.next







  def __str__(			self	):






         """simple docstring"""


         return "->".join([str(UpperCamelCase__	) for item in self]	)







  def __len__(			self	):






         """simple docstring"""


         return len(tuple(iter(self	)	)	)







  def    _a       (			self	):






         """simple docstring"""


         return self.top is None







  def    _a       (			self   ,	UpperCamelCase__	):






         """simple docstring"""


         a_						     =			Node(UpperCamelCase__	)
         if not self.is_empty():
                a_						     =			self.top
         a_						     =			node







  def    _a       (			self	):






         """simple docstring"""


         if self.is_empty():
                raise IndexError('pop from empty stack'	)
         assert isinstance(self.top   ,	UpperCamelCase__	)
         a_						     =			self.top
         a_						     =			self.top.next
         return pop_node.data







  def    _a       (			self	):






         """simple docstring"""


         if self.is_empty():
                raise IndexError('peek from empty stack'	)

         assert self.top is not None
         return self.top.data







  def    _a       (			self	):






         """simple docstring"""


         a_						     =			None


if __name__ == "__main__":
  from doctest import testmod

  testmod()




