Permutations III

Given a number n (1-9), generate all permutations of numbers 1 to n in lexicographic order.

Examples
Input: 1
Output: [[1]]
Hints

Permutations III

Given a number n (1-9), generate all permutations of numbers 1 to n in lexicographic order.