#include <bits/stdc++.h>
using namespace std;
const int maxn=1e3+10;
vector<int>g[maxn];
int n,v[maxn],dp[maxn][5010],f[maxn];
int dfs(int pos){
    dp[pos][0]=0;
    for (auto u:g[pos]){
        int w=dfs(u),k=v[u];
        
        memcpy(f,dp[pos],sizeof(f));
        memset(dp[pos],0x3f3f,sizeof(dp[pos]));
        
        for (int j=0; j<=v[pos]; j++){
            if(j+w<=v[pos]) dp[i][j+w]=min(dp[i][j+w],f[j]+k);
            if(j+k<=v[pos]) dp[i][j+k]=min(dp[i][j+k],f[j]+w);
        }
    }
    
    int ans=dp[0][0];
    for (int i=0; i<=v[pos]; i++)
        ans=min(ans,dp[pos][i]);
    return ans;
}
int main(){
    scanf("%d",&n);
    for (int p,i=2; i<=n; i++){
        scanf("%d",&p);
        g[p].push_back(i);
    }
    for (int i=1; i<=n; i++) scanf("%d",&v[i]);
    memset(dp,0x3f3f,sizeof(dp));


    if(dfs(1)<dp[0][0]) puts("POSSIBLE");
    else puts("IMPOSSIBLE");
    return 0;
}
