1374: 全排列

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:14 Solved:4

Description

打印n的全排列
例如3:
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1

Input

输入一个正整数   n

Output

输出n的全排列,每行一个排列,按字典序的顺序输出

Sample Input Copy

3

Sample Output Copy

1 2 3 
1 3 2 
2 1 3 
2 3 1 
3 1 2 
3 2 1 

HINT

$n\leq 9$

Source/Category