#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<vector<int>> adj;
vector<int> num;
vector<vector<int>> color;

bool ok = true;

void dfs(int n=0, int p=-1) {
  int s = adj[n].size();
  if (s==1&&p!=-1) {
    color[n][0] = num[n];
    color[n][1] = 0;
    return;
  }
  bool dp[s+1][s*5000+1] = {}; dp[0][0] = true;
  int pos = 0, sum = 0;
  for (auto x: adj[n]) {
    if (x==p) continue;
    dfs(x,n); if (!ok) break;
    rep(i,s*5000+1) {
      if (i>=color[x][0]) dp[pos+1][i] |= dp[pos][i-color[x][0]];
      if (i>=color[x][1]) dp[pos+1][i] |= dp[pos][i-color[x][1]];
    }
    pos++;
    sum += color[x][0] + color[x][1];
  }
  // cout << n << ":"; debug(dp[2],dp[2]+10);
  int lp = p==-1 ? s : s-1;
  per(i,num[n]+1) {
    if (dp[lp][i]) {
      color[n][0] = num[n];
      color[n][1] = sum - i;
      return;
    }
  }
  ok = false;
  return;
}

int main() {
  int N; cin >> N;
  adj.resize(N); num.resize(N);
  color.resize(N,vector<int>(2,-1));
  repr(i,1,N) {
    int P; cin >> P; P--;
    adj[P].push_back(i);
    adj[i].push_back(P);
  }
  rep(i,N) cin >> num[i];
  dfs(0);
  // rep(i,N) debug(all(color[i]));
  string result = ok ? "POSSIBLE" : "IMPOSSIBLE";
  cout << result << endl;
  return 0;
}