题目
This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supposed to write a program to test each of the options.
Input Specification:
Each input file contains one test case. For each case, the first line gives two positive integers N ( ≤ 1 , 000 ) N(\le1,000) N(≤1,000), the number of vertices in the graph, and M ( ≤ 10 , 000 ) M(\le10,000) M(≤10,000), the number of directed edges. Then M M M lines follow, each gives the start and the end vertices of an edge. The vertices are numbered from 1 to N N N