Create Hierarchical Graph from nodes

Problem Name:
Create Hierarchical Graph from nodes
Site:HackerEarth
Links:
Tags: