topsort working