#include <bits/stdc++.h>
using namespace std;
namespace {
const int INF = INT_MAX / 4;
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vs) {
  if (vs.empty()) return os << "[]";
  auto i = vs.begin();
  os << "[" << *i;
  for (++i; i != vs.end(); ++i) os << " " << *i;
  return os << "]";
}
template <class T>
istream& operator>>(istream& is, vector<T>& vs) {
  for (auto it = vs.begin(); it != vs.end(); it++) is >> *it;
  return is;
}
int N;
vector<int> P, X;
void input() {
  cin >> N;
  P.resize(N - 1);
  X.resize(N);
  cin >> P;
  cin >> X;
  for (auto& p : P) {
    p--;
  }
}
vector<vector<int>> C;
void solve() {
  C.resize(N);
  for (int i = 1; i < N; i++) {
    C[P[i - 1]].push_back(i);
  }
  vector<pair<int, int>> T(N);
  for (auto& t : T) t.first = t.second = INF;
  function<pair<int, int>(int)> dfs = [&](int v) -> pair<int, int> {
    if (C[v].empty()) {
      return T[v] = make_pair(0, X[v]);
    }
    if (T[v].first != INF) return T[v];
    auto cs = C[v];
    vector<pair<int, int>> ds;
    int first_sum = 0;
    int second_sum = 0;
    for (auto c : cs) {
      auto cres = dfs(c);
      ds.push_back(cres);
      first_sum += cres.first;
      second_sum += cres.second;
    }
    if (first_sum > X[v]) return T[v] = make_pair(INF - 1, INF - 1);
    vector<int> ss;
    int ss_sum = 0;
    for (auto d : ds) {
      ss.push_back(d.second - d.first);
      ss_sum += d.second - d.first;
    }
    vector<bool> dp(X[v] - first_sum + 1, false);
    dp[0] = true;
    int replace_max = 0;
    for (int i = 0; i < ss.size(); i++) {
      for (int k = X[v] - first_sum; k >= 0; k--) {
        int nk = k - ss[i];
        if (nk < 0) continue;
        if (dp[nk]) {
          dp[k] = true;
          replace_max = max(replace_max, k);
        }
      }
    }
    auto ret = make_pair(X[v], second_sum - replace_max);
    if (ret.first > ret.second) swap(ret.first, ret.second);
    return T[v] = ret;
  };
  auto t = dfs(0);
  if (t.second < INF - 2) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
}  // namespace
int main() {
  input();
  solve();
  return 0;
}
