DP DFS permutation