
from __future__ import annotations


def 							__A(lowerCAmelCase						,  lowerCAmelCase = None						,  lowerCAmelCase = None )		->				None:

		"""simple docstring"""






		if start is None:
				_UpperCamelCase						    =	0

		if end is None:
				_UpperCamelCase						    =	len(a_ ) - 1

		if start >= end:
				return

		_UpperCamelCase						    =	(start + end) // 2

		slowsort(a_						,  a_						,  a_ )
		slowsort(a_						,  mid + 1						,  a_ )

		if sequence[end] < sequence[mid]:
				_UpperCamelCase						    =	sequence[mid], sequence[end]

		slowsort(a_						,  a_						,  end - 1 )


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

						testmod()





def 							__A(lowerCAmelCase )		->				list[list[int]]:

		"""simple docstring"""






		_UpperCamelCase						    =	[]
		if len(lowerCAmelCase ) == 1:
				return [nums.copy()]
		for _ in range(len(lowerCAmelCase ) ):
				_UpperCamelCase						    =	nums.pop(0 )
				_UpperCamelCase						    =	permute(lowerCAmelCase )
				for perm in permutations:
						perm.append(lowerCAmelCase )
				result.extend(lowerCAmelCase )
				nums.append(lowerCAmelCase )
		return result


def 							__A(lowerCAmelCase )		->				Optional[int]:

		"""simple docstring"""






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

		_UpperCamelCase						    =	[]
		backtrack(0 )
		return output


if __name__ == "__main__":
		import doctest

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



