Any path from to splits into two parts: the path from up to and the path from down to . Both parts go up, from to and from to . Each part is a path from a node up to an ancestor. By the chain property, each part crosses chains.
The full path crosses chains total. To query a path, you walk up from to the LCA and from to the LCA, querying each chain segment you touch. You combine all the segment results.
Space complexity is for the data structures used.