






'''simple docstring'''







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

_A	:			str         =TypeVar('''KEY''')
_A	:			Optional[Any]         =TypeVar('''VAL''')

@dataclass(frozen=_lowercase				,      slots=_lowercase		)
class _lowercase	(				Generic[KEY, VAL]		):
							a				      =       42
							a				      =       42



class _lowercase	(				_Item		):




							def __init__(							self:				List[str]     ):
														super().__init__(UpperCamelCase__			,							UpperCamelCase__     )




							def __bool__(							self:				Optional[Any]     ):
														return False



_A	:			List[str]         =_DeletedItem()

class _lowercase	(				MutableMapping[KEY, VAL]		):




							def __init__(							self:				Any			,							UpperCamelCase__:				int = 8			,							UpperCamelCase__:				float = 0.75     ):
														lowerCamelCase__					:	Optional[Any]         =       initial_block_size
														lowerCamelCase__					:	list[_Item | None]         =       [None] * initial_block_size
														assert 0.0 < capacity_factor < 1.0
														lowerCamelCase__					:	Union[str, Any]         =       capacity_factor
														lowerCamelCase__					:	List[Any]         =       0




							def 		lowerCamelCase_				(							self:				Union[str, Any]			,							UpperCamelCase__:				KEY     ):
														return hash(UpperCamelCase__     ) % len(self._buckets     )




							def 		lowerCamelCase_				(							self:				List[str]			,							UpperCamelCase__:				int     ):
														return (ind + 1) % len(self._buckets     )




							def 		lowerCamelCase_				(							self:				List[Any]			,							UpperCamelCase__:				int			,							UpperCamelCase__:				KEY			,							UpperCamelCase__:				VAL     ):
														lowerCamelCase__					:	Any         =       self._buckets[ind]
														if not stored:
																					lowerCamelCase__					:	Optional[int]         =       _Item(UpperCamelCase__			,							UpperCamelCase__     )
																					self._len += 1
																					return True
														elif stored.key == key:
																					lowerCamelCase__					:	Tuple         =       _Item(UpperCamelCase__			,							UpperCamelCase__     )
																					return True
														else:
																					return False




							def 		lowerCamelCase_				(							self:				Tuple     ):
														lowerCamelCase__					:	List[Any]         =       len(self._buckets     ) * self._capacity_factor
														return len(self     ) >= int(UpperCamelCase__     )




							def 		lowerCamelCase_				(							self:				List[Any]     ):
														if len(self._buckets     ) <= self._initial_block_size:
																					return False
														lowerCamelCase__					:	Optional[int]         =       len(self._buckets     ) * self._capacity_factor / 2
														return len(self     ) < limit




							def 		lowerCamelCase_				(							self:				Union[str, Any]			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	Tuple         =       self._buckets
														lowerCamelCase__					:	Union[str, Any]         =       [None] * new_size
														lowerCamelCase__					:	List[Any]         =       0
														for item in old_buckets:
																					if item:
																												self._add_item(item.key			,							item.val     )




							def 		lowerCamelCase_				(							self:				Optional[Any]     ):
														self._resize(len(self._buckets     ) * 2     )




							def 		lowerCamelCase_				(							self:				Union[str, Any]     ):
														self._resize(len(self._buckets     ) // 2     )




							def 		lowerCamelCase_				(							self:				Any			,							UpperCamelCase__:				KEY     ):
														lowerCamelCase__					:	Tuple         =       self._get_bucket_index(UpperCamelCase__     )
														for _ in range(len(self._buckets     )     ):
																					yield ind
																					lowerCamelCase__					:	int         =       self._get_next_ind(UpperCamelCase__     )




							def 		lowerCamelCase_				(							self:				Tuple			,							UpperCamelCase__:				KEY			,							UpperCamelCase__:				VAL     ):
														for ind in self._iterate_buckets(UpperCamelCase__     ):
																					if self._try_set(UpperCamelCase__			,							UpperCamelCase__			,							UpperCamelCase__     ):
																												break




							def __setitem__(							self:				Optional[Any]			,							UpperCamelCase__:				KEY			,							UpperCamelCase__:				VAL     ):
														if self._is_full():
																					self._size_up()

														self._add_item(UpperCamelCase__			,							UpperCamelCase__     )




							def __delitem__(							self:				Tuple			,							UpperCamelCase__:				KEY     ):
														for ind in self._iterate_buckets(UpperCamelCase__     ):
																					lowerCamelCase__					:	List[Any]         =       self._buckets[ind]
																					if item is None:
																												raise KeyError(UpperCamelCase__     )
																					if item is _deleted:
																												continue
																					if item.key == key:
																												lowerCamelCase__					:	Union[str, Any]         =       _deleted
																												self._len -= 1
																												break
														if self._is_sparse():
																					self._size_down()




							def __getitem__(							self:				Dict			,							UpperCamelCase__:				KEY     ):
														for ind in self._iterate_buckets(UpperCamelCase__     ):
																					lowerCamelCase__					:	Optional[int]         =       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:				str     ):
														return self._len




							def __iter__(							self:				Union[str, Any]     ):
														yield from (item.key for item in self._buckets if item)




							def __repr__(							self:				List[str]     ):
														lowerCamelCase__					:	Tuple         =       """ ,""".join(
														    F'''{item.key}: {item.val}''' for item in self._buckets if item     )
														return F'''HashMap({val_string})'''





def 							__lowercase   ( __lowerCAmelCase							:				list[int]   ):
							a__             =     []
							if len(__lowerCAmelCase   ) == 1:
														return [nums.copy()]
							for _ in range(len(__lowerCAmelCase   )   ):
														a__             =     nums.pop(0   )
														a__             =     permute(__lowerCAmelCase   )
														for perm in permutations:
																					perm.append(__lowerCAmelCase   )
														result.extend(__lowerCAmelCase   )
														nums.append(__lowerCAmelCase   )
							return result






def 							__lowercase   ( __lowerCAmelCase							:				Optional[int]   ):

							def backtrack(__lowerCAmelCase							:				Any   ):
														if start == len(__lowerCAmelCase   ) - 1:
																					output.append(nums[:]   )
														else:
																					for i in range(__lowerCAmelCase					,    len(__lowerCAmelCase   )   ):
																												a__      ,					a__             =     nums[i], nums[start]
																												backtrack(start + 1   )
																												a__      ,					a__             =     nums[i], nums[start]  # backtrack

							a__             =     []
							backtrack(0   )
							return output


if __name__ == "__main__":
						import doctest

						# use res to print the data in permute2 function
						snake_case							:       Optional[Any]     			=      permutea([1, 2, 3])
						print(res)
						doctest.testmod()




