#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long mod2 = 998244353;
long long inf = 1000000000000000000;
long long lmax(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long lmin(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
pair<long long, long long> f(vector<pair<long long, long long> > v,
                             long long n) {
  long long sum = 0;
  for (int i = 0; i < v.size(); i++) sum += v[i].first + v[i].second;
  long long u = v.size();
  vector<long long> now;
  if (v[0].first <= n) now.push_back(v[0].first);
  if (v[0].second <= n) now.push_back(v[0].second);
  for (int i = 1; i < u; i++) {
    vector<long long> w;
    for (int j = 0; j < now.size(); j++) {
      if (now[j] + v[i].first <= n) w.push_back(now[j] + v[i].first);
      if (now[j] + v[i].second <= n) w.push_back(now[j] + v[i].second);
    }
    now = w;
  }
  long long ret = -1;
  for (int i = 0; i < now.size(); i++) {
    ret = max(ret, now[i]);
  }
  return make_pair(ret, sum - ret);
}
int main() {
  long long n;
  cin >> n;
  long long p[n + 1];
  vector<long long> v[n + 1];
  for (int i = 2; i < n + 1; i++) {
    cin >> p[i];
    v[p[i]].push_back(i);
  }
  long long x[n + 1];
  for (int i = 1; i < n + 1; i++) cin >> x[i];
  long long cnt[n + 1];
  fill(cnt, cnt + n + 1, 0);
  pair<long long, long long> sco[n + 1];
  queue<long long> q;
  for (int i = 1; i < n + 1; i++) {
    if (v[i].size() == 0) {
      sco[i] = make_pair(x[i], 0);
      cnt[p[i]]++;
      if (cnt[p[i]] == v[p[i]].size()) q.push(p[i]);
    }
  }
  while (q.size() > 0) {
    long long now = q.front();
    q.pop();
    vector<pair<long long, long long> > w;
    for (int i = 0; i < v[now].size(); i++) w.push_back(sco[v[now][i]]);
    pair<long long, long long> e = f(w, x[now]);
    if (e.first == -1) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    if (now == 1) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
    sco[now] = make_pair(x[now], e.second);
    cnt[p[now]]++;
    if (cnt[p[now]] == v[p[now]].size()) q.push(p[now]);
  }
}
