{"raw_statement":[{"iden":"problem statement","content":"Niwango has $N$ cards, numbered $1,2,\\ldots,N$. He will now arrange these cards in a row.\nNiwango wants to know if there is a way to arrange the cards while satisfying all the $N$ conditions below. To help him, determine whether such a way exists. If the answer is yes, also find the lexicographically smallest such arrangement.\n\n*   To the immediate right of Card $1$ (if any) is NOT Card $a_1$.\n*   To the immediate right of Card $2$ (if any) is NOT Card $a_2$.\n*   $\\vdots$\n*   To the immediate right of Card $N$ (if any) is NOT Card $a_N$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 10^{5}$\n*   $1 \\leq a_i \\leq N$\n*   $a_i \\neq i$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$a_1$ $a_2$ $\\ldots$ $a_N$"},{"iden":"sample input 1","content":"4\n2 3 4 1"},{"iden":"sample output 1","content":"1 3 2 4\n\n*   The arrangement $(1,2,3,4)$ is lexicographically smaller than $(1,3,2,4)$, but is invalid, since it violates the condition \"to the immediate right of Card $1$ is not Card $2$.\""},{"iden":"sample input 2","content":"2\n2 1"},{"iden":"sample output 2","content":"\\-1\n\n*   If no arrangements satisfy the conditions, print `-1`."},{"iden":"sample input 3","content":"13\n2 3 4 5 6 7 8 9 10 11 12 13 12"},{"iden":"sample output 3","content":"1 3 2 4 6 5 7 9 8 10 12 11 13"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}