#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long INF = (long long)1 << 60;
long long N;
vector<vector<long long> > ed;
vector<long long> X;
bool res = true;
set<long long> st1;
set<long long> st2;
pair<long long, long long> dfs(long long a) {
  vector<pair<long long, long long> > ps;
  pair<long long, long long> tmp;
  long long sum = 0;
  for (long long i = 0; i < ed[a].size(); i++) {
    tmp = dfs(ed[a][i]);
    ps.push_back(tmp);
    sum += tmp.first + tmp.second;
  }
  st1.clear();
  st1.insert(0);
  st2.clear();
  pair<long long, long long> ret;
  if (!res) {
    return ret;
  }
  ret.first = INF;
  ret.second = INF;
  for (long long i = 0; i < ps.size(); i++) {
    st2 = st1;
    for (auto s : st2) {
      st1.insert(s + ps[i].first);
      st1.insert(s + ps[i].second);
    }
  }
  st1.erase(0);
  bool f = false;
  if (st1.size() > 0) {
    for (auto s : st1) {
      if (min(s, sum - s) > X[a]) {
      } else {
        f = true;
        if (max(s, sum - s) <= X[a]) {
          ret.first = X[a];
          ret.second = min(ret.second, min(s, sum - s));
        } else {
          ret.first = min(ret.first, max(s, sum - s));
          ret.second = min(ret.second, X[a]);
        }
      }
    }
  } else {
    f = true;
    ret.first = X[a];
    ret.second = 0;
  }
  if (!f) {
    res = false;
  }
  return ret;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  ed.resize(N);
  long long a;
  for (long long i = 1; i < N; i++) {
    cin >> a;
    a--;
    ed[a].push_back(i);
  }
  X.resize(N);
  for (long long i = 0; i < N; i++) {
    cin >> X[i];
  }
  dfs(0);
  if (res) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
