#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=1010;
const ll mod=1e9+7;

int n;
int a[mx];
vector<int> v[mx];

P dfs(int x){
  if(v[x].empty()){ return {0,a[x]}; }
  bitset<5050> bit;
  bit.set(0);
  int sum=0;
  for(auto to : v[x]){
    P p=dfs(to);
    if(p.F==-1){return {-1,-1};}
    bit = (bit<<p.first | bit<<p.second);
    sum += p.first+p.second;
  }
  
  for(int i=a[x]; i>=0; i--){ if(bit[i]){ return {a[x],sum-i}; }}
  return {-1,-1};
}

int main() {
  cin >> n;
  rep(i,n-1){
    int x;  cin >> x;
    v[x-1].push_back(i+1);
  }
  rep(i,n){ cin >> a[i]; }
  
  cout << (dfs(0).first!=-1?"POSSIBLE":"IMPOSSIBLE") << endl; 
  return 0;
}  
