
"""simple docstring"""



from typing import Any
class        _SCREAMING_SNAKE_CASE  :






				'''simple docstring'''



				def __init__(					self	:			int				,     UpperCAmelCase_	:			Any  )		->  int:







											"""simple docstring"""




											_lowerCAmelCase  	=			data
											_lowerCAmelCase  	=			None






class        _SCREAMING_SNAKE_CASE  :






				'''simple docstring'''



				def __init__(					self	:			List[str]  )		->  str:







											"""simple docstring"""




											_lowerCAmelCase  	=			None


				def 				__lowerCamelCase	(					self	:			str  )		->  Optional[int]:







											"""simple docstring"""




											_lowerCAmelCase  	=			self.head
											while temp is not None:
																		print(temp.data				,     end=' '  )
																		_lowerCAmelCase  	=			temp.next
											print()


				def 				__lowerCamelCase	(					self	:			Union[str, Any]				,     UpperCAmelCase_	:			Any  )		->  Union[str, Any]:







											"""simple docstring"""




											_lowerCAmelCase  	=			Node(__UpperCamelCase  )
											_lowerCAmelCase  	=			self.head
											_lowerCAmelCase  	=			new_node







				def 				__lowerCamelCase	(					self	:			Tuple				,     UpperCAmelCase_	:			Optional[int]				,     UpperCAmelCase_	:			Union[str, Any]  )		->  Optional[Any]:







											"""simple docstring"""




											if node_data_a == node_data_a:
																		return
											else:
																		_lowerCAmelCase  	=			self.head
																		while node_a is not None and node_a.data != node_data_a:
																									_lowerCAmelCase  	=			node_a.next

																		_lowerCAmelCase  	=			self.head
																		while node_a is not None and node_a.data != node_data_a:
																									_lowerCAmelCase  	=			node_a.next

																		if node_a is None or node_a is None:
																									return

																		_lowerCAmelCase	,		_lowerCAmelCase  	=			node_a.data, node_a.data


if __name__ == "__main__":
							_snake_case          =						LinkedList()
							for i in range(5, 0, -1):
														ll.push(i)

							ll.print_list()

							ll.swap_nodes(1, 4)
							print('''After swapping''')
							ll.print_list()








"""simple docstring"""



def 	__snake_case  (    SCREAMING_SNAKE_CASE:					list[int]						):






							"""simple docstring"""



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






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					Any						):






							"""simple docstring"""



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

							_lowerCAmelCase  	=			[]
							backtrack(0						)
							return output


if __name__ == "__main__":
	import doctest

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






