#include <iostream>
#include <vector>
#include <bitset>
#define MAXN 1005
#define MAXVAL 5005
using namespace std;

int n, val[MAXN], dp[MAXN];
bitset<MAXVAL> bs;
vector<int> G[MAXN];

bool DFS(int u) {
    for (auto x: G[u]) {
        if (!DFS(x))
            return 0;
    }

    bs.reset();
    bs[0] = 1;

    int S = 0;
    for (auto x: G[u]) {
        bs = (bs << val[x]) | (bs << dp[x]);
        S += val[x] + dp[x];
    }

    for (int i = val[u]; i >= 0; --i) {
        if (bs[i]) {
            dp[u] = S - i;
            return 1;
        }
    }

    return 0;
}

int main() {
    ios::sync_with_stdio(0);

    cin >> n;
    for (int i = 2; i <= n; ++i) {
        int x;
        cin >> x;
        G[x].push_back(i);
    }

    for (int i = 1; i <= n; ++i)
        cin >> val[i];

    cout << (DFS(1) ? "POSSIBLE\n" : "IMPOSSIBLE\n");

    return 0;
}