#include <bits/stdc++.h>
using namespace std;
unordered_map<long, unordered_set<long>> children;
vector<long> X(5050, 0);
pair<long, long> rec(long node) {
  if (children[node].size() == 0) {
    return make_pair(X[node], 0);
  }
  set<pair<long, long>> ret;
  ret.insert(make_pair(0, 0));
  for (auto c : children[node]) {
    set<pair<long, long>> next;
    auto c_res = rec(c);
    for (auto before : ret) {
      next.insert(
          make_pair(before.first + c_res.first, before.second + c_res.second));
      next.insert(
          make_pair(before.first + c_res.second, before.second + c_res.first));
    }
    ret = next;
  }
  long minimum = -1;
  for (auto it : ret) {
    if (it.first <= X[node]) {
      if (minimum == -1 or minimum > it.second) minimum = it.second;
    }
  }
  return make_pair(X[node], minimum);
}
int main(void) {
  cout.precision(12);
  long N;
  cin >> N;
  for (long i = 2; i <= N; i++) {
    long p;
    cin >> p;
    children[p].insert(i);
  }
  for (long i = 1; i <= N; i++) cin >> X[i];
  auto result = rec(1);
  if (result.second != -1)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
