
"""simple docstring"""


from collections.abc import Iterator, MutableMapping
from dataclasses import dataclass
from typing import Generic, TypeVar

SCREAMING_SNAKE_CASE      =     TypeVar("""KEY""")
SCREAMING_SNAKE_CASE      =     TypeVar("""VAL""")



@dataclass(frozen=_lowerCAmelCase    ,     slots=_lowerCAmelCase	)
class   __a  (      Generic[KEY, VAL]	):
       UpperCamelCase_		:					KEY
       UpperCamelCase_		:					VAL





class   __a  (      _Item	):






       def __init__(  self :							Union[str, Any]			)->  None:







              """simple docstring"""
              super().__init__(UpperCAmelCase_       ,      UpperCAmelCase_			)






       def __bool__(  self :							Optional[int]			)->  bool:







              """simple docstring"""
              return False





SCREAMING_SNAKE_CASE      =     _DeletedItem()



class   __a  (      MutableMapping[KEY, VAL]	):






       def __init__(  self :							int       ,      UpperCAmelCase_ :							int = 8       ,      UpperCAmelCase_ :							float = 0.75			)->  None:







              """simple docstring"""
              UpperCamelCase					 =		initial_block_size
              UpperCamelCase					 =		[None] * initial_block_size
              assert 0.0 < capacity_factor < 1.0
              UpperCamelCase					 =		capacity_factor
              UpperCamelCase					 =		0






       def 	_SCREAMING_SNAKE_CASE       (  self :							List[Any]       ,      UpperCAmelCase_ :							KEY			)->  int:







              """simple docstring"""
              return hash(UpperCAmelCase_			) % len(self._buckets			)






       def 	_SCREAMING_SNAKE_CASE       (  self :							Optional[int]       ,      UpperCAmelCase_ :							int			)->  int:







              """simple docstring"""
              return (ind + 1) % len(self._buckets			)






       def 	_SCREAMING_SNAKE_CASE       (  self :							str       ,      UpperCAmelCase_ :							int       ,      UpperCAmelCase_ :							KEY       ,      UpperCAmelCase_ :							VAL			)->  bool:







              """simple docstring"""
              UpperCamelCase					 =		self._buckets[ind]
              if not stored:
                     UpperCamelCase					 =		_Item(UpperCAmelCase_       ,      UpperCAmelCase_			)
                     self._len += 1
                     return True
              elif stored.key == key:
                     UpperCamelCase					 =		_Item(UpperCAmelCase_       ,      UpperCAmelCase_			)
                     return True
              else:
                     return False






       def 	_SCREAMING_SNAKE_CASE       (  self :							str			)->  bool:







              """simple docstring"""
              UpperCamelCase					 =		len(self._buckets			) * self._capacity_factor
              return len(self			) >= int(UpperCAmelCase_			)






       def 	_SCREAMING_SNAKE_CASE       (  self :							Optional[int]			)->  bool:







              """simple docstring"""
              if len(self._buckets			) <= self._initial_block_size:
                     return False
              UpperCamelCase					 =		len(self._buckets			) * self._capacity_factor / 2
              return len(self			) < limit






       def 	_SCREAMING_SNAKE_CASE       (  self :							Union[str, Any]       ,      UpperCAmelCase_ :							int			)->  None:







              """simple docstring"""
              UpperCamelCase					 =		self._buckets
              UpperCamelCase					 =		[None] * new_size
              UpperCamelCase					 =		0
              for item in old_buckets:
                     if item:
                            self._add_item(item.key       ,      item.val			)






       def 	_SCREAMING_SNAKE_CASE       (  self :							int			)->  None:







              """simple docstring"""
              self._resize(len(self._buckets			) * 2			)






       def 	_SCREAMING_SNAKE_CASE       (  self :							List[str]			)->  None:







              """simple docstring"""
              self._resize(len(self._buckets			) // 2			)






       def 	_SCREAMING_SNAKE_CASE       (  self :							Optional[int]       ,      UpperCAmelCase_ :							KEY			)->  Iterator[int]:







              """simple docstring"""
              UpperCamelCase					 =		self._get_bucket_index(UpperCAmelCase_			)
              for _ in range(len(self._buckets			)			):
                     yield ind
                     UpperCamelCase					 =		self._get_next_ind(UpperCAmelCase_			)






       def 	_SCREAMING_SNAKE_CASE       (  self :							Any       ,      UpperCAmelCase_ :							KEY       ,      UpperCAmelCase_ :							VAL			)->  None:







              """simple docstring"""
              for ind in self._iterate_buckets(UpperCAmelCase_			):
                     if self._try_set(UpperCAmelCase_       ,      UpperCAmelCase_       ,      UpperCAmelCase_			):
                            break






       def __setitem__(  self :							int       ,      UpperCAmelCase_ :							KEY       ,      UpperCAmelCase_ :							VAL			)->  None:







              """simple docstring"""
              if self._is_full():
                     self._size_up()

              self._add_item(UpperCAmelCase_       ,      UpperCAmelCase_			)






       def __delitem__(  self :							List[str]       ,      UpperCAmelCase_ :							KEY			)->  None:







              """simple docstring"""
              for ind in self._iterate_buckets(UpperCAmelCase_			):
                     UpperCamelCase					 =		self._buckets[ind]
                     if item is None:
                            raise KeyError(UpperCAmelCase_			)
                     if item is _deleted:
                            continue
                     if item.key == key:
                            UpperCamelCase					 =		_deleted
                            self._len -= 1
                            break
              if self._is_sparse():
                     self._size_down()






       def __getitem__(  self :							Union[str, Any]       ,      UpperCAmelCase_ :							KEY			)->  VAL:







              """simple docstring"""
              for ind in self._iterate_buckets(UpperCAmelCase_			):
                     UpperCamelCase					 =		self._buckets[ind]
                     if item is None:
                            break
                     if item is _deleted:
                            continue
                     if item.key == key:
                            return item.val
              raise KeyError(UpperCAmelCase_			)






       def __len__(  self :							Optional[Any]			)->  int:







              """simple docstring"""
              return self._len






       def __iter__(  self :							List[Any]			)->  Iterator[KEY]:







              """simple docstring"""
              yield from (item.key for item in self._buckets if item)






       def __repr__(  self :							Any			)->  str:







              """simple docstring"""
              UpperCamelCase					 =		" ,".join(
                  f"{item.key}: {item.val}" for item in self._buckets if item			)
              return f"HashMap({val_string})"







"""simple docstring"""


def 	lowerCamelCase__			(							UpperCAmelCase_				)->							list:







       """simple docstring"""

       if len(UpperCAmelCase_				) <= 1:
              return [tuple(UpperCAmelCase_				)]

       UpperCamelCase					 =		[]

       def generate(UpperCAmelCase_		,      UpperCAmelCase_				):
              if k == 1:
                     res.append(tuple(arr[:]				)				)
                     return

              generate(k - 1		,      UpperCAmelCase_				)

              for i in range(k - 1				):
                     if k % 2 == 0:  # k is even
                            UpperCamelCase ,       UpperCamelCase					 =		arr[k - 1], arr[i]
                     else:  # k is odd
                            UpperCamelCase ,       UpperCamelCase					 =		arr[k - 1], arr[0]
                     generate(k - 1		,      UpperCAmelCase_				)

       generate(len(UpperCAmelCase_				)		,      UpperCAmelCase_				)
       return res


if __name__ == "__main__":
      SCREAMING_SNAKE_CASE      =     input("""Enter numbers separated by a comma:\n""").strip()
      SCREAMING_SNAKE_CASE      =     [int(item) for item in user_input.split(""",""")]
      print(heaps(arr))





