This problem is in Contest(s) below:
Contest 1221:拓扑排序