Permutations III

Given an integer n, return every permutation of the numbers 1 to n in which adjacent elements always have different parity. An odd value may never sit next to another odd value, and an even value may never sit next to another even value. List the valid permutations in lexicographic order.

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

Permutations III

Given an integer `n`, return every permutation of the numbers `1` to `n` in which adjacent elements always have different parity. An odd value may never sit next to another odd value, and an even value may never sit next to another even value. List the valid permutations in lexicographic order.