Python DFS Solution
\nclass Solution:\n    def smallestMissingValueSubtree(self, parents: List[int], nums: List[int]) -> List[int]:\n        numNodes, missing = len(parents), 1\n  
```\nclass Solution:\n    def smallestMissingValueSubtree(self, parents: List[int], nums: List[int]) -> List[int]:\n        numNodes, missing = len(parents), 1\n        adj, visited = defaultdict(list), set()\n        res, node = [1 for _ in range(numNodes)], -1\n        for i in range(1, numNodes):\n            adj[parents[i]].append(i)\n        for i in range(numNodes):\n            if nums[i] == 1:\n                node = i\n                break\n        if node == -1:\n            return res\n        \n        def dfs(node: int):\n            nonlocal visited, adj\n            for child in adj[node]:\n                if nums[child] not in visited:\n                    visited.add(nums[child])\n                    dfs(child)\n        \n        while node != -1:\n            visited.add(nums[node])\n            dfs(node)\n            while missing in visited:\n                missing += 1\n            res[node] = missing\n            node = parents[node]\n        return res\n```
['Depth-First Search', 'Recursion', 'Python']