Identifying Hierarchies for Fast Optimal Search