#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
  int n;
  cin >> n;
  vi p(n);
  vvi p_(n);
  for (int i = 0; i < n - 1; ++i) {
    cin >> p[i + 1];
    --p[i + 1];
    p_[p[i + 1]].push_back(i + 1);
  }
  vi x(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  stack<int> topo;
  queue<int> q;
  topo.push(0);
  q.push(0);
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    for (int x : p_[now]) {
      q.push(x);
      topo.push(x);
    }
  }
  bool ok = true;
  vector<vector<P> > dp(n);
  for (int i = 0; i < n; ++i) {
    int now = topo.top();
    topo.pop();
    if (p_[now].empty()) {
      dp[p[now]].push_back(P(0, x[now]));
    } else {
      int num = dp[now].size();
      vi data(num);
      int sum = 0;
      int sum_ = 0;
      for (int j = 0; j < num; ++j) {
        data[j] = dp[now][j].second - dp[now][j].first;
        sum += dp[now][j].first;
        sum_ += dp[now][j].second;
      }
      if (sum > x[now]) {
        ok = false;
        break;
      } else if (sum == x[now]) {
        if (now == n - 1) break;
        dp[p[now]].push_back(P(sum, sum_));
        continue;
      } else {
        if (now == n - 1) break;
        vi dp_(x[now] - sum + 1, -1);
        dp_[0] = 0;
        for (int j = 0; j < num; ++j) {
          for (int k_ = 0; k_ < x[now] - sum + 1 - data[j]; ++k_) {
            int k = x[now] - sum - k_;
            if (dp_[k - data[j]] != -1) {
              dp_[k] = 0;
            }
          }
        }
        int ma = 0;
        for (int j = 0; j < x[now] - sum + 1; ++j) {
          if (!dp_[j]) ma = j;
        }
        sum = x[now];
        sum_ -= ma;
        if (sum > sum_) swap(sum, sum_);
        dp[p[now]].push_back(P(sum, sum_));
      }
    }
  }
  cout << (ok ? "POSSOBLE" : "IMPOSSIBLE") << endl;
}
