#include <bits/stdc++.h>
template <class T>
bool maxi(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool mini(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
bool ok = true;
vector<ll> X(5050);
vector<ll> other(5050);
struct edge {
  ll to;
};
struct graph {
  ll N;
  vector<vector<edge> > G;
  graph(ll n) : N(n), G(N) {}
  void ade(ll s, ll t) { G[s].emplace_back((edge){t}); }
  void dfs(ll v = 0) {
    for (auto E : G[v]) {
      dfs(E.to);
    }
    vector<ll> A(5050, 1000000000000000037);
    A[0] = 0;
    for (auto E : G[v]) {
      for (ll i = 5020; i >= 0; i--) {
        if (A[i] == 1000000000000000037) continue;
        ll buf = A[i];
        A[i] = 1000000000000000037;
        if (i + X[E.to] <= X[v]) {
          mini(A[i + X[E.to]], buf + other[E.to]);
        }
        if (i + other[E.to] <= X[v]) {
          mini(A[i + other[E.to]], buf + X[E.to]);
        }
      }
    }
    ll ans = 1000000000000000037;
    for (ll i = 0; i < X[v] + 1; i++) {
      mini(ans, A[i]);
    }
    if (ans == 1000000000000000037) {
      ok = false;
    }
    other[v] = ans;
  }
};
void Main() {
  ll N;
  cin >> N;
  graph g(N);
  for (ll i = 0; i < N - 1; i++) {
    ll p;
    cin >> p;
    --p;
    g.ade(p, i + 1);
  }
  for (ll i = 0; i < N; i++) {
    cin >> X[i];
  }
  g.dfs(0);
  cout << (ok ? "POSSSIBLE" : "IMPOSSIBLE") << "\n";
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
