we all understand the traditional way of building a hierarchy normally following a top down approach.
We sit with a challenge requiring that the hierarchy needed to build up from the bottom up using a lowest level reference code. As per the attached picture. Each lowest level will have a specific code identifying where it is physical situated in the organisation. The code by implication implies the roll-up . See the attached picture.

Problem Statement - When we have the codes, is there a way of importing the list and using that to develop the roll-up structure.In real life this can be very complex and high volumes.
It can be done using a manual mapping but an automated manner will be much more elegant.