Question
Every node in a tree stores only the id of its parent. Given two node ids, find their deepest shared ancestor using those upward links alone. ```python def solve(raw: str) -> str: ... ``` ## Requirements - Line one is the node count `n`. Line two gives `n` parent ids in node order: the value at position `i` is the parent of node `i`, and a root is marked `-1`. - Line three holds the two query ids separated by whitespace. - Node identity is the array position, so ids run from `0` to `n - 1`. - A node counts as an ancestor of itself, so querying a node against one of its descendants returns that node. - Return the id of the deepest common ancestor as a decimal string, or `-1` when the two nodes belong to different trees. - The structure exposes no child lists, so work upward; keep the cost proportional to the two ancestor paths rather than to `n`. - `run_case` passes `case["stdin"]` to `solve`. - Do not append a trailing newline to the returned string; return the value exactly once.