use DFS to iterate the nested list'