There is a directed graph with N vertices and N edges. The vertices are numbered 1, 2, ..., N.
The 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.
We 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.
 - Each a_i is a non-negative integer.
 - For each edge (i, j), a_i \neq a_j holds.
 - 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.
Determine whether there exists such an assignment.

-----Constraints-----
 - 2 ≤ N ≤ 200 000
 - 1 ≤ p_i ≤ N
 - p_i \neq i
 - The graph is weakly connected.

-----Input-----
Input is given from Standard Input in the following format:
N
p_1 p_2 ... p_N

-----Output-----
If the assignment is possible, print POSSIBLE; otherwise, print IMPOSSIBLE.

-----Sample Input-----
4
2 3 4 1

-----Sample Output-----
POSSIBLE

The assignment is possible: {a_i} = {0, 1, 0, 1} or {a_i} = {1, 0, 1, 0}.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "# 結局は木+1辺\nfrom collections import defaultdict\nimport heapq as hq\n\nN = int(input())\nP = list(map(lambda x:int(x)-1,input().split()))\nD = [0]*N\nfor p in P:\n  D[p] += 1\n\nchild_L = defaultdict(list)\n\nS = [p for p in range(N) if D[p] == 0]\nL = [None]*N\n\nwhile S:\n  n = S.pop()\n\n  q = child_L[n]\n  del child_L[n]\n\n  hq.heapify(q)\n  i = 0\n  while q:\n    t = hq.heappop(q)\n    if i < t:\n      break\n    else:\n      i += (i==t)\n  \n  L[n] = i\n  m = P[n]\n  child_L[m].append(i)\n  D[m] -= 1\n  if D[m] == 0:\n    S.append(m)\n\n# cycle check\ntry:\n  start = D.index(1)\nexcept ValueError:\n  print('POSSIBLE')\n  return\n\ndef helper(n):\n  q = child_L[n]\n  del child_L[n]\n  \n  hq.heapify(q)\n  i = 0\n  while q:\n    t = hq.heappop(q)\n    if i < t:\n      break\n    else:\n      i += (i==t)\n\n  j = i+1\n  while q:\n    t = hq.heappop(q)\n    if j < t:\n      break\n    else:\n      j += (j==t)\n\n  return (i,j)\n\n\ns1,s2 = helper(start)\nG = []\nn = P[start]\nwhile n != start:\n  G.append(helper(n))\n  n = P[n]\n\n\ndel N,P,D,child_L,S,L\n\n\n# 可能な初期値をそれぞれシミュレート\n# 1\nn = s1\nfor g in G:\n  if g[0] == n:\n    n = g[1]\n  else:\n    n = g[0]\nif n != s1:\n  print('POSSIBLE')\n  return\n\n# 2\nn = s2\nfor g in G:\n  if g[0] == n:\n    n = g[1]\n  else:\n    n = g[0]\nif n == s1:\n  print('POSSIBLE')\n  return\n\nprint('IMPOSSIBLE')"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: