#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;

int N, P[1010], X[1010];
vector<vector<int> > G(1010);

// pair=<large,small>
pair<int,int> dfs(int v){
  int n=G[v].size();
  if(n==0) return make_pair(X[v],0);
  int dp[n+1][X[v]+1]={};
  dp[0][0]=1;
  int sum=0, flag=1;
  rep(i,G[v].size()){
    pair<int,int> tmp=dfs(G[v][i]);
    sum+=tmp.first+tmp.second;
    if(tmp.second==0) flag=0;
    rep(j,X[v]+1) if(dp[i][j]!=0){
      dp[i+1][j]=1;
      if(j+tmp.second<=X[v]) dp[i+1][j+tmp.second]=1;
      if(j+tmp.first<=X[v]) dp[i+1][j+tmp.first]=1;
    }
  }
  int ok=5050;
  for(int j=flag;j<=X[v];j++) if(dp[n][j]) ok=j;
  pair<int,int> res;
  if(ok==5050){
    cout<<"IMPOSSIBLE\n";
    exit(0);
  }else{
    res=make_pair(max(X[v],sum-ok), min(X[v],sum-ok));
  }
  return res;
}

int main(){
  cin>>N;
  rep(i,N-1){
    cin>>P[i]; P[i]--;
    G[P[i]].push_back(i+1);
  }
  rep(i,N) cin>>X[i];
  dfs(0);
  cout<<"POSSIBLE\n";
  return 0;
}
