import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto N = readln.chomp.to!int;
    auto P = readln.split.map!(to!int).array;
    auto X = readln.split.map!(to!int).array;
    auto edges = new int[][](N);
    foreach (i; 0..N-1) {
        edges[i] ~= P[i] - 1;
        edges[P[i] - 1] ~= i;
    }

    if (N == 1) {
        writeln("POSSIBLE");
        return;
    }


    int dfs(int n, int p) {
        if (p != -1 && edges[n].length == 1)
            return 0;

        int[][] tmp;
        foreach (m; edges[n])
            if (m != p)
                tmp ~= [dfs(m, n), X[m]];

        foreach (t; tmp)
            if (t[0] > X[n] && t[1] > X[n])
                return -1;
            else if (t[0] == -1)
                return -1;

        auto dp = new bool[][](2, X[n] + 1);
        dp[0][0] = true;
        int cur = 0, tar = 1;

        foreach (i; 0..tmp.length) {
            dp[tar].fill(false);
            foreach (j; 0..X[n]+1)
                if (dp[cur][j] && j + tmp[i][0] <= X[n])
                    dp[tar][j + tmp[i][0]] = true;
                else if (dp[cur][j] && j + tmp[i][1] <= X[n])
                    dp[tar][j + tmp[i][1]] = true;
            cur ^= 1;
            tar ^= 1;
        }

        int ss = 0;
        foreach (t; tmp)
            ss += t[0] + t[1];

        foreach (i; 0..X[n]+1)
            if (dp[cur][i] && ss - i <= X[n])
                return i;

        return -1;
    }

    auto ret = dfs(0, -1);
    writeln(ret == -1 ? "IMPOSSIBLE" : "POSSIBLE");
}
