/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
vector<ll> tree[1010];
ll dp[1010] = {};
ll X[1010];
bool ok = true;
void dfs(ll cur, ll par){
    for(auto &e: tree[cur]){
        if(e == par) continue;
        dfs(e, cur);
    }
    if(tree[cur].size() == 0){
        dp[cur] = 0;
    }else{
        ll n = tree[cur].size();
        ll opt = INF;
        rep(bit,0,(1LL<<n)) {
            ll v1 = 0, v2 = 0;
            rep(i,0,n){
                ll c = tree[cur][i];
                if((bit>>i) & 1){
                    v1 += dp[c];
                    v2 += X[c];
                }else{
                    v2 += dp[c];
                    v1 += X[c];
                }
            }
            if(v1 <= X[cur]){
                opt = min(opt, v2);
            }
            if(v2 <= X[cur]){
                opt = min(opt, v1);
            }
        }
        if(opt == INF) ok = false;
        dp[cur] = opt;
    }
}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    if(N > 10) return 0;
    ll P[1010];
    rep(i,0,N-1){
        cin >> P[i];
        P[i]--;
        tree[P[i]].push_back(i+1);
    })
    rep(i,0,N) cin >> X[i];
    rep(i,0,N) dp[i] = INF;
    dfs(0, -1);
    if(ok){
        print("POSSIBLE");
    }else{
        print("IMPOSSIBLE");
    }

}