{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n h1 { font-size: 1.2em; }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n\u003cdiv class\u003d\"md\"\u003e\u003cp\u003eYou want to complete \u003cspan class\u003d\"math inline\"\u003e$ n $\u003c/span\u003e courses that have requirements of the form \"course \u003cspan class\u003d\"math inline\"\u003e$ a $\u003c/span\u003e has to be completed before course \u003cspan class\u003d\"math inline\"\u003e$ b $\u003c/span\u003e\".\u003c/p\u003e\n\u003cp\u003eYou want to complete course \u003cspan class\u003d\"math inline\"\u003e$ 1 $\u003c/span\u003e as soon as possible. If there are several ways to do this, you want then to complete course \u003cspan class\u003d\"math inline\"\u003e$ 2 $\u003c/span\u003e as soon as possible, and so on.\u003c/p\u003e\n\u003cp\u003eYour task is to determine the order in which you complete the courses.\u003c/p\u003e\n\u003ch1 id\u003d\"input\"\u003eInput\u003c/h1\u003e\n\u003cp\u003eThe first input line has two integers \u003cspan class\u003d\"math inline\"\u003e$ n $\u003c/span\u003e and \u003cspan class\u003d\"math inline\"\u003e$ m $\u003c/span\u003e: the number of courses and requirements. The courses are numbered \u003cspan class\u003d\"math inline\"\u003e$ 1,2,\\dots,n $\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eThen, there are \u003cspan class\u003d\"math inline\"\u003e$ m $\u003c/span\u003e lines describing the requirements. Each line has two integers \u003cspan class\u003d\"math inline\"\u003e$ a $\u003c/span\u003e and \u003cspan class\u003d\"math inline\"\u003e$ b $\u003c/span\u003e: course \u003cspan class\u003d\"math inline\"\u003e$ a $\u003c/span\u003e has to be completed before course \u003cspan class\u003d\"math inline\"\u003e$ b $\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eYou can assume that there is at least one valid schedule.\u003c/p\u003e\n\u003ch1 id\u003d\"output\"\u003eOutput\u003c/h1\u003e\n\u003cp\u003ePrint one line having \u003cspan class\u003d\"math inline\"\u003e$ n $\u003c/span\u003e integers: the order in which you complete the courses.\u003c/p\u003e\n\u003ch1 id\u003d\"constraints\"\u003eConstraints\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le n \\le 10^5 $\u003c/span\u003e\u003c/li\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le m \\le 2 \\cdot 10^5 $\u003c/span\u003e\u003c/li\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le a,b \\le n $\u003c/span\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id\u003d\"example\"\u003eExample\u003c/h1\u003e\n\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 2\n2 1\n2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 1 3 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e "}}]}