#P337. 练57.1 全排列问题

练57.1 全排列问题

Description

Output all unique permutations of the natural numbers from 11 to nn, i.e., the full permutation of nn, ensuring that no duplicate digits appear in any generated sequence.

Input Format

An integer nn (1n91≤n≤9).

Output Format

All unique sequences of digits from 11 to nn, with one sequence per line. Each digit should be padded to a width of 55.

Sample

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