#C13042. Lexicographic Permutations

    ID: 42537 Type: Default 1000ms 256MiB

Lexicographic Permutations

Lexicographic Permutations

Given a positive integer \(n\), your task is to generate all unique permutations of the digits from 1 to \(n\) and print them in lexicographical order.

The output should list each permutation on a new line. For example:

  • For \(n = 1\): the output is 1.
  • For \(n = 2\): the output is 12 followed by 21 on the next line.
  • For \(n = 3\): the output is 123, 132, 213, 231, 312, and 321, each on its own line.

Remember to follow stdin for input and stdout for output.

inputFormat

The input consists of a single integer \(n\) (\(1 \le n \le 9\)) provided via standard input.

outputFormat

Output all the lexicographically ordered permutations of the digits from 1 to \(n\). Each permutation should be printed in a new line.

## sample
1
1

</p>