Creating a path from leaves