recursively solve Permutation