Pergunta de entrevista da empresa Morgan Stanley

problem was on hierarchy print based on a string. There are some employee manager relationship and based on input string , we have to print complete hierarchy. For e.g. Ajay-> Ramesh Deepesh-> Animesh Mohan->Ajay Rahul-> Mohan Input: Rahul Output: Rahul->Mohan->Ajay->Ramesh