Build a tree based on the pre- and post-order traversals. Once the tree is constructed answer lowest common ancestor queries.
Fun problem. Use graphs ??? profit.