solution to Permutations II