import sys
a = int(input()) # 只有一行輸入
f = [str(c) for c in range(1, a+1)]
# 輸入 3 --> ['1', '2', '3']
d = permutations(f)
'''
利用 permutations 求全排列
print(list(d)) 可以觀察 d
[('1', '2', '3'), ('1', '3', '2'),
('2', '1', '3'), ('2', '3', '1'),
('3', '1', '2'), ('3', '2', '1')]
'''
for u in d:
sys.stdout.write(' '.join(u) + '\n')
沒有留言:
張貼留言