//
// Created by kapildd on 10/5/17.
//
#include <bits/stdc++.h>
#define MAX_X 5010
#define MAX_VAL (1e9)
using namespace std;

int dfs(int v, int parent, vector< vector<int> >& adj, vector<int>& X) {
    vector<long long> dp(MAX_X, MAX_VAL);
    vector<long long> extra(MAX_X, MAX_VAL);
    dp[0] = 0;
    for(int i=0; i<adj[v].size(); i++) {
        int u = adj[v][i];
        if(u == parent) continue;
        int white = dfs(u, v, adj, X);
        if(white==MAX_VAL) continue;
        fill(extra.begin(), extra.end(), MAX_VAL);
        for(int j = 0; j<MAX_X-white; j++) {
            extra[j+white] = min(extra[j+white], dp[j]+X[u]);
        }
        for(int j=0; j<MAX_X-X[u]; j++) {
            extra[j+X[u]] = min(extra[j+X[u]], dp[j]+white);
        }
        swap(extra, dp);
    }
    int min_w = MAX_VAL;
    for(int i=0; i<=X[v]; i++) {
        min_w = min(min_w, dp[i]);
    }
    return min_w;
}

int main() {
    int n;
    cin>>n;
    vector<int> parent(n+1, 0), X(n+1);
    vector< vector<int> > adj(n+1);
    for(int i=2; i<=n; i++) {
        cin>>parent[i];
        adj[parent[i]].push_back(i);
    }
    for(int i=1; i<=n; i++) {
        cin>>X[i];
    }
    string ans = "IMPOSSIBLE";
    int cval = dfs(1, 0, adj, X);
    if(cval < MAX_VAL)
        ans = "POSSIBLE";
    cout << ans << endl;
    return 0;
}