#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;;

const ll INF = 5e15;
const P impossible = P(-1, -1);
vector<vector<ll>> edge;
vector<ll> X;

P dfs(ll now, ll pre){
    vector<P> ret;
    for(ll next : edge[now]) if(next != pre) ret.push_back(dfs(next, now));
    if(!ret.size()) return P(0, X[now]);
    vector<ll> dp(5001, INF);
    dp[0] = 0;
    for(P r : ret){
        if(r == impossible) return impossible;
        vector<ll> nextdp(5001, INF);
        for(ll i = 0; i <= 5000; i++){
            if(i + r.first > 5000) break;
            if(dp[i] == INF) continue;
            if(dp[i] != INF) nextdp[i + r.first] = min(nextdp[i + r.first], dp[i] + r.second);
            if(i + r.second <= 5000) nextdp[i + r.second] = min(nextdp[i + r.second], dp[i] + r.first);
        }
        dp = nextdp;
    }
    vector<P> tmp;
    for(ll i = 0; i <= 5000; i++){
        if(dp[i] != INF){
            if(i <= X[now] && dp[i] <= X[now]) tmp.push_back(P(min(i, dp[i]), X[now]));
            else if(i > X[now] && dp[i] > X[now]) continue;
            else return tmp.push_back(P(X[now], max(i, dp[i])));
        }
    }
    if(!tmp.size()) return impossible;
    sort(tmp.begin(), tmp.end());
    return tmp[0];
}

int main(){
    ll N;
    cin >> N;
    edge.resize(N);
    X.resize(N);
    for(ll i = 1; i < N; i++){
        ll p;
        cin >> p;
        edge[i].push_back(--p);
        edge[p].push_back(i);
    }
    for(ll &x : X) cin >> x;
    P ans = dfs(0, -1);
    if(ans == impossible) cout << "IM";
    cout << "POSSIBLE\n";
    return 0;
}
