#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1003,INF = 0x3f3f3f3f;
int n,X[MaxN];
vector<int> e[MaxN];
int dp[MaxN];

bool dfs(int x) {
    vector<int> f;f.resize(X[x]+1,INF);f[0]=0;
    for (auto v:e[x]) {
        if (!dfs(v)) return false;
        vector<int> g;g.resize(X[x]+1,INF);
        for (int i=0;i<=X[x]-X[v];++i) g[i+X[v]]=min(g[i+X[v]],f[i]+dp[v]);
        for (int i=0;i<=X[x]-dp[v];++i) g[i+dp[v]]=min(g[i+dp[v]],f[i]+X[v]);
        f=g;
    }
    dp[x]=INF;
    for (auto i:f) dp[x]=min(dp[x],i);
    return dp[x]<INF;
}

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    cin >> n;
    for (int i=2;i<=n;++i) {
        int x;cin >> x;
        e[x].push_back(i);
    }
    for (int i=1;i<=n;++i) cin >> X[i];
    if (dfs(1)) cout << "POSSIBLE\n";
    else cout << "IMPOSSIBLE\n";
    return 0;
}