import itertools


"""Given an array A of positive integers (not necessarily distinct), return the lexicographically largest permutation 
that is smaller than A, that can be made with one swap (A swap exchanges the positions of two numbers A[i] and A[j]). 
 If it cannot be done, then return the same array."""

 

 


print(list(itertools.permutations([1, 2, 3])))