



def      UpperCamelCase(    __UpperCamelCase				:						list[int]					):
		lowerCAmelCase_     :	List[str]							   =					[]
		if len(__UpperCamelCase					) == 1:
				return [nums.copy()]
		for _ in range(len(__UpperCamelCase					)					):
				lowerCAmelCase_     :	Optional[Any]							   =					nums.pop(0					)
				lowerCAmelCase_     :	List[Any]							   =					permute(__UpperCamelCase					)
				for perm in permutations:
						perm.append(__UpperCamelCase					)
				result.extend(__UpperCamelCase					)
				nums.append(__UpperCamelCase					)
		return result


def      UpperCamelCase(    __UpperCamelCase				:						str					):

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

		lowerCAmelCase_     :	Optional[int]							   =					[]
		backtrack(0					)
		return output


if __name__ == "__main__":
						import doctest

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







'''simple docstring'''
def 		A_(     A						:		list[int]):
							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 		A_(     A						:		str):

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




