#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = (ll)1e18;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr ll dx[4] = {1LL, 0LL, -1LL, 0LL};
constexpr ll dy[4] = {0LL, 1LL, 0LL, -1LL};
constexpr ll dx8[8] = {1LL, 0LL, -1LL, 0LL, 1LL, 1LL, -1LL, -1LL};
constexpr ll dy8[8] = {0LL, 1LL, 0LL, -1LL, 1LL, -1LL, 1LL, -1LL};
void p() { std::cout << '\n'; }
template <typename Head, typename... Tail>
void p(Head head, Tail... tail) {
  std::cout << head << (sizeof...(tail) ? " " : "");
  p(tail...);
}
template <typename T>
inline void pv(std::vector<T>& v) {
  for (ll i = 0, N = v.size(); i < N; i++)
    std::cout << v[i] << " \n"[i == N - 1];
}
template <typename T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
inline bool chmax(T& a, T b) {
  return a < b && (a = b, true);
}
template <typename T>
inline bool chmin(T& a, T b) {
  return a > b && (a = b, true);
}
template <typename T>
inline void uniq(std::vector<T>& v) {
  v.erase(std::unique(v.begin(), v.end()), v.end());
}
vector<ll> X;
pair<ll, ll> dfs(vector<vector<ll>>& g, ll v, ll p) {
  vector<pair<ll, ll>> vec;
  for (ll nextv : g[v]) {
    if (nextv == p) continue;
    pair<ll, ll> pr = dfs(g, nextv, v);
    vec.push_back(pr);
  }
  do {
  } while (false);
  if (vec.size() == 0) {
    return {X[v], 0};
  }
  ll sum = 0;
  vector<ll> item;
  for (ll i = 0, i_length = (vec.size()); i < i_length; ++i) {
    item.push_back(max(vec[i].first, vec[i].second));
    sum += min(vec[i].first, vec[i].second);
  }
  if (sum > X[v]) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
  ll size = X[v] - sum + 1;
  vector<bool> dp(size, false);
  dp[0] = true;
  for (ll i = 0, i_length = (item.size()); i < i_length; ++i) {
    for (ll j = (size)-1; j >= 0; --j) {
      if (j - item[i] >= 0 && dp[j - item[i]]) dp[j] = true;
    }
  }
  do {
  } while (false);
  ll t = 0;
  for (ll i = 0, i_length = (vec.size()); i < i_length; ++i)
    t += vec[i].first + vec[i].second;
  for (ll i = (size)-1; i >= 0; --i) {
    if (dp[i]) {
      ll x = X[v] - i;
      do {
      } while (false);
      return {X[v], t - X[v] + x};
    }
  }
}
void solve() {
  ll N;
  cin >> N;
  vector<vector<ll>> g(N);
  for (ll i = 1, i_length = (N - 1); i <= i_length; ++i) {
    ll a;
    cin >> a;
    a--;
    g[a].push_back(i);
    g[i].push_back(a);
  }
  X.assign(N, 0);
  for (ll i = 0, i_length = (N); i < i_length; ++i) cin >> X[i];
  dfs(g, 0, -1);
  cout << "POSSIBLE" << endl;
}
signed main() {
  solve();
  return 0;
}
