#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
using VI = vector<long long>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
long long N;
VI p, x;
VVI child;
vector<P> dist;
long long dfs(long long v) {
  if (dist[v].first != -1) {
    return dist[v].first;
  }
  if (v == 0) {
    return dist[v].first = 0;
  }
  return dist[v].first = (dfs(p[v]) + 1);
}
void solve() {
  dist = vector<P>(N, {-1, 0});
  for (long long(i) = 0; (i) < (N); (i)++) {
    dist[i].second = i;
  }
  for (long long(i) = 0; (i) < (N); (i)++) {
    dfs(i);
  }
  sort(dist.begin(), dist.end(), greater<P>());
  VVI dp(N + 1, VI(2, 0));
  for (long long(i) = 0; (i) < (N); (i)++) {
    long long v = dist[i].second;
    long long other = 1e6;
    if (dp[child[v][0]][0] + dp[child[v][1]][0] <= x[v]) {
      other = min(other, dp[child[v][0]][1] + dp[child[v][1]][1]);
    }
    if (dp[child[v][0]][0] + dp[child[v][1]][1] <= x[v]) {
      other = min(other, dp[child[v][0]][1] + dp[child[v][1]][0]);
    }
    if (dp[child[v][0]][1] + dp[child[v][1]][0] <= x[v]) {
      other = min(other, dp[child[v][0]][0] + dp[child[v][1]][1]);
    }
    if (dp[child[v][0]][1] + dp[child[v][1]][1] <= x[v]) {
      other = min(other, dp[child[v][0]][0] + dp[child[v][1]][0]);
    }
    if (other == 1e6) {
      cout << "IMPOSSIBLE" << endl;
      return;
    }
    dp[v][0] = x[v];
    dp[v][1] = other;
  }
  cout << "POSSIBLE" << endl;
}
signed main() {
  cin >> N;
  p = VI(N);
  x = VI(N);
  child = VVI(N);
  for (long long(i) = 0; (i) < (N - 1); (i)++) {
    cin >> p[i + 1];
    p[i + 1]--;
    child[p[i + 1]].push_back(i + 1);
  }
  for (long long(i) = 0; (i) < (N); (i)++) {
    while (child[i].size() < 2) {
      child[i].push_back(N);
    }
  }
  for (long long(i) = 0; (i) < (N); (i)++) {
    cin >> x[i];
  }
  solve();
}
