from collections import deque

N = int(input())
P = [0] + list(map(int, input().split()))
X = list(map(int, input().split()))

leaves = [v-1 for v in range(1, N+1) if v not in set(P)]
stack = deque()
dp = [(0, 0) for _ in range(N)]
for l in leaves:
    dp[l] = (X[l], X[l])
    stack.appendleft((P[l]-1, l))

ans = "IMPOSSIBLE"
while stack:
    v, c = stack.pop()
    f = True
    if v == -1:
        continue
    if dp[c][0] <= X[v]:
        dp[v] = (X[v], dp[v][1])
        f = False
    if dp[c][1] <= X[v]:
        dp[v] = (dp[v][0], X[v])
        f = False
    if f:
        break
    stack.appendleft((P[v]-1, v))

if dp[0][0] == X[0] or dp[0][1] == X[0]:
    ans = "POSSIBLE"

print(ans)