Topological sort basic working