simulator based on toposort ordering passes tests!