{"raw_statement":[{"iden":"problem statement","content":"There is a directed graph with $N$ vertices and $N$ edges. The vertices are numbered $1, 2, ..., N$.\nThe graph has the following $N$ edges: $(p_1, 1), (p_2, 2), ..., (p_N, N)$, and the graph is weakly connected. Here, an edge from Vertex $u$ to Vertex $v$ is denoted by $(u, v)$, and a weakly connected graph is a graph which would be connected if each edge was bidirectional.\nWe would like to assign a value to each of the vertices in this graph so that the following conditions are satisfied. Here, $a_i$ is the value assigned to Vertex $i$.\n\n*   Each $a_i$ is a non-negative integer.\n*   For each edge $(i, j)$, $a_i \\neq a_j$ holds.\n*   For each $i$ and each integer $x(0 ≤ x < a_i)$, there exists a vertex $j$ such that the edge $(i, j)$ exists and $x = a_j$ holds.\n\nDetermine whether there exists such an assignment."},{"iden":"constraints","content":"*   $2 ≤ N ≤ 200$ $000$\n*   $1 ≤ p_i ≤ N$\n*   $p_i \\neq i$\n*   The graph is weakly connected."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$p_1$ $p_2$ ... $p_N$"},{"iden":"sample input 1","content":"4\n2 3 4 1"},{"iden":"sample output 1","content":"POSSIBLE\n\nThe assignment is possible: {$a_i$} = {$0, 1, 0, 1$} or {$a_i$} $=$ {$1, 0, 1, 0$}."},{"iden":"sample input 2","content":"3\n2 3 1"},{"iden":"sample output 2","content":"IMPOSSIBLE"},{"iden":"sample input 3","content":"4\n2 3 1 1"},{"iden":"sample output 3","content":"POSSIBLE\n\nThe assignment is possible: {$a_i$} $=$ {$2, 0, 1, 0$}."},{"iden":"sample input 4","content":"6\n4 5 6 5 6 4"},{"iden":"sample output 4","content":"IMPOSSIBLE"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}