Processing math: 100%
Reading order - MarisaOJ: Marisa Online Judge

Reading order

Time limit: 1000 ms
Memory limit: 256 MB
Marisa got n strage books from Kourindou, and she wants to read them all. Rinnosuke told her m constraints of the form i,j that book i should be read before book j. Find an order of reading books, which does not violate any given constraints, for Marisa. ### Input - The first line contains two integers n,m. - The next m lines, each line contains two integers i,j, a constraint. ### Output - Print n distinct integers, the reading order. Rinnosuke guarantees that the answer exists. If there are more than one answer, print any. ### Constraints - 1≤n≤105. - 1≤i,j≤n. ### Example Input: 5412231315 Output: 14253