eolymp
bolt
Try our new interface for solving problems
Problems

Permutations

Permutations

Given a positive integer $n$, print all permutations of the integers from $1$ to $n$ in lexicographical order. \InputFile One positive integer $n\:(1 \le n \le 8)$. \OutputFile Print all permutations of the integers from $1$ to $n$ in lexicographical order. Print each permutation on a separate line.
Time limit 1 second
Memory limit 128 MiB
Input example #1
3
Output example #1
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1