DFS solution to P0006