from collections import deque

N = int(input())
P = [i-1 for i in list(map(int, input().split()))]
C = [[] for _ in range(N)]
for i, p in enumerate(P, 1):
    C[p].append(i)
P = [-1] + P
X = list(map(int, input().split()))

# 今の頂点，各色の重み
dp = [[0] * 2 for _ in range(N)]
que = deque(i for i in range(N) if not C[i])
while que:
    v = que.popleft()
    c = C[v]
    n = len(c)
    res = 10 ** 9
    if not n:
        res = 0
    for i in range(1 << n):
        tmp = [0, 0]
        for j in range(n):
            if (i >> j):
                tmp[0] += dp[c[j]][0]
                tmp[1] += dp[c[j]][1]
            else:
                tmp[0] += dp[c[j]][1]
                tmp[1] += dp[c[j]][0]
        if tmp[0] > X[v]:
            continue
        res = min(res, tmp[1])
    if res == 10 ** 9:
        break
    dp[v][0] = X[v]
    dp[v][1] = res
    if P[v] == -1:
        continue
    que.append(P[v])

print('POSSIBLE' if dp[0][0] == X[0] else 'IMPOSSIBLE')
