# coding: utf-8
from collections import defaultdict, deque

import numpy as np


def solve(*args: str) -> str:
    n = int(args[0])
    P = list(map(int, args[1].split()))
    X = list(map(int, args[2].split()))

    T = defaultdict(set)
    for i, p in enumerate(P):
        T[p-1].add(i+1)

    stack = []
    Q = deque()
    Q.append(0)
    while Q:
        i = Q.popleft()
        stack.append(i)
        for c in T[i]:
            Q.append(c)

    ret = 'POSSIBLE'
    inf = 2**32-1
    Y = [0]*n
    for i in stack[::-1]:
        dp = np.full(X[i]+1, inf, np.int64)
        dp[0] = 0
        x_acc, y_acc = 0, 0
        for c in T[i]:
            x, y = X[c], Y[c]
            x_acc += x
            y_acc += y
            dp = np.minimum(
                np.concatenate((dp[:x], dp[:-x]+y)),
                np.concatenate((dp[:y], dp[:-y if 0 < y else len(dp)]+x))
            )

        A = np.sort(dp[1:])
        if len(T[i]) == 0:
            Y[i] = 0
        elif A[0] < inf:
            Y[i] = A[0]
        elif y_acc != 0:
            ret = 'IMPOSSIBLE'
            break
        else:
            Y[i] = x_acc

    return ret


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
