Given an array of distinct integers, return all possible orderings (permutations).
Input: one line of space-separated integers. Output: one permutation per line, space-separated. Any generation order — the template prints canonically.
1 2 3
1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1
1
1
Run your code against the sample tests, or Submit to run the full suite.