Topological sort implemented in Challenge03