12443 - Permutations   

Description

A permutation, also called an “arrangement number” or “order,” is a rearrangement of the elements of an ordered list into a one-to-one correspondence S_i. A string of length N has N! permutation. You need to show all results. 

ORDER is important !! You should display it in lexicographic order.

ex. N=3, 

1 2 3

1 3 2

2 1 3

2 3 1

3 1 2

3 2 1

 

Input

N

1<=N<=6

Output

S_i is a sequence each element followed by a space.

S_1

S_2

.

.

.

S_N! 

You still need to change line in the last line.

Sample Input  Download

Sample Output  Download

Tags




Discuss