permutation backtracking python