





'''simple docstring'''







from ..utils import DummyObject, requires_backends
class 				__SCREAMING_SNAKE_CASE  (metaclass=lowerCamelCase_      ):






				"""simple docstring"""







				__a            =['torch', 'scipy']




				def __init__(  self     :					Any					,				*__a     :					List[Any]					,				**__a     :					Any					):
								requires_backends(self					,				["torch", "scipy"]					)




				@classmethod
				def   UpperCamelCase__   (  cls     :					Any					,				*__a     :					Optional[int]					,				**__a     :					Optional[int]					):
								requires_backends(cls					,				["torch", "scipy"]					)




				@classmethod
				def   UpperCamelCase__   (  cls     :					List[Any]					,				*__a     :					Tuple					,				**__a     :					Any					):
								requires_backends(cls					,				["torch", "scipy"]					)




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()




