The obvious answer here is to have a single class representing the object, then a reference to the parent object if there is one. The query across the tree would be to start at a given node of the tree and return all parent objects of that node. Each node will have only one direct parent node.
Is there a better way to do this computationally or from a software design perspective?
EDIT: Looking for computational complexity improvement suggestions or maintainability suggestions. Memory is not a huge issue here.