#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
template <typename T>
void chmin(T &a, const T &b) {
  a = min(a, b);
}
template <typename T>
void chmax(T &a, const T &b) {
  a = max(a, b);
}
struct FastIO {
  FastIO() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
} fastiofastio;
const ll INF = 1LL << 60;
int main(void) {
  ll n;
  cin >> n;
  vector<vector<ll>> g(n);
  for (ll i = (ll)0; i < (ll)n - 1; ++i) {
    ll p;
    cin >> p;
    p--;
    g[p].push_back(i + 1);
    g[i + 1].push_back(p);
  }
  vector<ll> x(n);
  for (ll i = (ll)0; i < (ll)n; ++i) cin >> x[i];
  function<ll(ll, ll)> dfs = [&](ll v, ll p) {
    vector<ll> ch, val;
    for (auto to : g[v]) {
      if (to == p) continue;
      ll tmp = dfs(to, v);
      if (tmp == INF) {
        cout << "IMPOSSIBLE" << endl;
        exit(0);
      }
      ch.push_back(to);
      val.push_back(tmp);
    }
    if (ch.size() == 0) return 0LL;
    vector<vector<ll>> dp(ch.size(), vector<ll>(x[v] + 1, INF));
    {
      ll mi = min(x[ch[0]], val[0]), ma = max(x[ch[0]], val[0]);
      for (ll i = (ll)0; i < (ll)mi; ++i) dp[0][i] = INF;
      for (ll i = (ll)mi; i < (ll)min(x[v] + 1, ma); ++i) dp[0][i] = ma;
      for (ll i = (ll)ma; i < (ll)x[v] + 1; ++i) dp[0][i] = mi;
    }
    for (ll i = (ll)1; i < (ll)ch.size(); ++i)
      for (ll j = (ll)0; j < (ll)x[v] + 1; ++j) {
        if (j >= x[ch[i]]) chmin(dp[i][j], dp[i - 1][j - x[ch[i]]] + val[i]);
        if (j >= val[i]) chmin(dp[i][j], dp[i - 1][j - val[i]] + x[ch[i]]);
      }
    ll mi = INF;
    for (ll i = (ll)0; i < (ll)x[v] + 1; ++i) chmin(mi, dp[ch.size() - 1][i]);
    return mi;
  };
  if (dfs(0, -1) < INF)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
