#include <bits/stdc++.h>
using namespace std;
template <typename T>
void readvec(vector<T> &a);
void readindex(vector<long long> &a);
pair<long long, long long> devide(vector<long long> &B, vector<long long> &W,
                                  long long K) {
  long long N = B.size();
  vector<vector<bool> > dp(N + 1, vector<bool>(K + 1, false));
  dp[0][0] = true;
  for (long long i = (0); i < (N); i++) {
    for (long long k = (0); k < (K + 1); k++) {
      if (dp[i][k]) {
        if (k + B[k] <= K) dp[i + 1][k + B[k]] = true;
        if (k + W[k] <= K) dp[i + 1][k + W[k]] = true;
      }
    }
  }
  long long x1 = -1, x2 = 0;
  for (long long i = (K + 1) - 1; i >= (0); i--) {
    if (dp[N][i]) {
      x1 = i;
      break;
    }
  }
  for (long long i = (0); i < (N); i++) x2 += B[i] + W[i];
  return pair<long long, long long>(x1, x2);
}
signed main() {
  long long N;
  cin >> N;
  vector<vector<long long> > ko(N, vector<long long>(0)),
      depth(N, vector<long long>(0));
  long long P, maxdepth = 1;
  for (long long i = (1); i < (N); i++) {
    cin >> P;
    P--;
    ko[P].push_back(i);
  }
  depth[0].push_back(0);
  for (long long i = (0); i < (N); i++) {
    if (depth[i].size() == 0) break;
    maxdepth++;
    for (long long j = (0); j < (depth[i].size()); j++) {
      for (long long k = (0); k < (ko[depth[i][j]].size()); k++) {
        depth[i + 1].push_back(ko[depth[i][j]][k]);
      }
    }
  }
  vector<long long> X(N);
  readvec(X);
  vector<long long> B(N), W(N, 0);
  for (long long i = (0); i < (N); i++) B[i] = X[i];
  for (long long i = (maxdepth - 1) - 1; i >= (0); i--) {
    for (long long j = (0); j < (depth[i].size()); j++) {
      long long l = depth[i][j];
      if (ko[l].size() == 0) continue;
      long long n = ko[l].size();
      vector<long long> b(n), w(n);
      for (long long k = (0); k < (n); k++) {
        b[k] = B[ko[l][k]], w[k] = W[ko[l][k]];
      }
      pair<long long, long long> res = devide(b, w, X[l]);
      if (res.first == -1) {
        cout << "IMPOSSIBLE";
        return 0;
      } else {
        B[l] = X[l];
        W[l] = res.second;
      }
    }
  }
  cout << "POSSIBLE";
  return 0;
}
template <typename T>
void readvec(vector<T> &a) {
  for (long long i = (0); i < (a.size()); i++) {
    cin >> a[i];
  }
}
void readindex(vector<long long> &a) {
  for (long long i = (0); i < (a.size()); i++) {
    cin >> a[i];
    a[i]--;
  }
}
