All Permutations

No attempts yetTime limit1sMemory limit256 MB

Problem

Given NN, print every permutation of the numbers 11 through NN in lexicographic order.

Input

The first line contains NN. (1N81 \le N \le 8)

Output

Starting from the first line, print all permutations in lexicographic order over N!N! lines. Print one permutation per line, with a single space between numbers.