finish DFS recursive