Query to find Top down Hierarchy

Database
Tourist

Query to find Top down Hierarchy

Hi everyone,
Basically my requirement is to generate Top down hierarchy datasets for 10 levels from the input file which is in bottom up hierarchy with below sample data.

Emp.no Mgrlv1 Mgrlv2 Mgrlv3..... Mgrlv10
A B D P
P P
C D P
Here P is the CEO of organization. I need the output datasets in Below order.
Emp.no Mgrlv1 Mgrlv2 Mgrlv3...... 10
A P D B
P P
C P D

Thanks in advance.