#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;


// dp[i]:iの子の，iと違う色の総和の最小値
int N, X[1010], dp[1010];
vector<vector<int> > G(1010);
// from[i]:親の色の子の総和がiの時の，親と違う色の子の総和の最小値
int from[5050], to[5050];
const int INF=1e9;

int main(){
  cin>>N;
  rep(i,N-1){
    int p; cin>>p; p--;
    G[p].push_back(i+1);
  }
  rep(i,N) cin>>X[i];
  for(int i=N-1;i>=0;i--){
    rep(j,5050) from[j]=INF;
    from[0]=0;
    for(auto v:G[i]){
      rep(j,5050) to[j]=INF;
      rep(j,5002) if(from[j]<INF){
        int x=min(5001,j+X[v]), y=min(5001,j+dp[v]);
        to[x]=min({to[x], from[j]+dp[v], 5001});
        to[y]=min({to[y], from[j]+X[v], 5001});
      }
      swap(from,to);
    }
    dp[i]=INF;
    rep(j, X[i]+1) dp[i]=min(dp[i],from[j]);
    if(dp[i]==INF){
      cout<<"IMPOSSIBLE\n";
      return 0;
    }
  }
  cout<<"POSSIBLE\n";
  return 0;
}
