Hierarchy structure finding