{"raw_statement":[{"iden":"problem statement","content":"Among the sequences $P$ that are permutations of $(1, 2, \\dots, N)$ and satisfy the condition below, find the lexicographically smallest sequence.\n\n*   For each $i = 1, \\dots, M$, $A_i$ appears earlier than $B_i$ in $P$.\n\nIf there is no such $P$, print `-1`."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq M \\leq 2 \\times 10^5$\n*   $1 \\leq A_i, B_i \\leq N$\n*   $A_i \\neq B_i$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $B_1$\n$\\vdots$\n$A_M$ $B_M$"},{"iden":"sample input 1","content":"4 3\n2 1\n3 4\n2 4"},{"iden":"sample output 1","content":"2 1 3 4\n\nThe following five permutations $P$ satisfy the condition: $(2, 1, 3, 4), (2, 3, 1, 4), (2, 3, 4, 1), (3, 2, 1, 4), (3, 2, 4, 1)$. The lexicographically smallest among them is $(2, 1, 3, 4)$."},{"iden":"sample input 2","content":"2 3\n1 2\n1 2\n2 1"},{"iden":"sample output 2","content":"\\-1\n\nNo permutations $P$ satisfy the condition."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}