

def    __lowerCAmelCase   (    A     ):
	UpperCAmelCase_												=      []
	if len(a_     ) == 1:
		return [nums.copy()]
	for _ in range(len(a_     )     ):
		UpperCAmelCase_												=      nums.pop(0     )
		UpperCAmelCase_												=      permute(a_     )
		for perm in permutations:
			perm.append(a_     )
		result.extend(a_     )
		nums.append(a_     )
	return result



def    __lowerCAmelCase   (    A     ):

	def backtrack(A     ):
		if start == len(a_     ) - 1:
			output.append(nums[:]     )
		else:
			for i in range(a_							,  len(a_     )     ):
				UpperCAmelCase_												=      nums[i], nums[start]
				backtrack(start + 1     )
				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
				_a:     Optional[Any]							=      permutea([1, 2, 3])
				print(res)
				doctest.testmod()







'''simple docstring'''

from abc import ABC, abstractmethod
from argparse import ArgumentParser




class      A     (   SCREAMING_SNAKE_CASE__    ):






 """simple docstring"""





 @staticmethod
 @abstractmethod
 def 	_UpperCAmelCase							(				__lowerCAmelCase			):
       raise NotImplementedError()





 @abstractmethod
 def 	_UpperCAmelCase							(				self			):
       raise NotImplementedError()






