Fixed topological sort