#include <bits/stdc++.h>
using namespace std;
long long N;
long long X[1010];
long long P[1010];
vector<long long> C[1010];
pair<long long, long long> cp[1010];
long long dp[1010][5010];
pair<long long, long long> solve(long long n) {
  long long children = C[n].size();
  for (long long i = 1; i <= children; i++) {
    cp[i] = solve(C[n][i - 1]);
  }
  memset(dp, 0, sizeof(dp));
  for (long long i = 1; i <= children; i++) {
    for (long long w = 0; w <= X[n]; w++) {
      if (cp[i].first <= w && cp[i].second <= w) {
        dp[i][w] = min(dp[i - 1][w - cp[i].first] + cp[i].second,
                       dp[i - 1][w - cp[i].second] + cp[i].first);
      } else if (cp[i].first <= w) {
        dp[i][w] = dp[i - 1][w - cp[i].first] + cp[i].second;
      } else if (cp[i].second <= w) {
        dp[i][w] = dp[i - 1][w - cp[i].second] + cp[i].first;
      } else {
        dp[i][w] = 100000000000;
      }
    }
  }
  if (dp[children][X[n]] == 100000000000) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  } else {
    return make_pair(X[n], dp[children][X[n]]);
  }
}
signed main(void) {
  cin >> N;
  X[1] = 1;
  for (long long i = 2; i <= N; i++) {
    cin >> P[i];
    C[P[i]].push_back(i);
  }
  for (long long i = 1; i <= N; i++) cin >> X[i];
  solve(1);
  cout << "POSSIBLE" << endl;
  return 0;
}
