from itertools import permutations
lst = list(permutations(range(1, 4)))
print(lst)
for i in range(len(lst)):
print(lst[i])
'''
run:
[(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)]
(1, 2, 3)
(1, 3, 2)
(2, 1, 3)
(2, 3, 1)
(3, 1, 2)
(3, 2, 1)
'''