#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<long long>;
using pii = pair<long long, long long>;
const signed INF_ = 1001001001;
const ll INF = 1001001001001001001LL;
const long long DX[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0},
                DY[9] = {-1, 0, 1, 0, -1, 1, 1, -1, 0};
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (auto i = (begin(v)); i != (end(v)); ++i)
    os << *i << (i == end(v) - 1 ? "" : " ");
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto i = (begin(v)); i != (end(v)); ++i) is >> *i;
  return is;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
using heap = priority_queue<T, vector<T>, greater<T>>;
struct {
  template <class T>
  operator T() {
    T x;
    cin >> x;
    return x;
  }
} IN;
struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(15) << fixed;
  }
} before_main_function;
signed main() {
  long long N;
  cin >> N;
  vector<long long> x(N);
  vector<vector<long long>> tree(N);
  for (long long i = 0, ilen = (long long)(N - 1); i < ilen; ++i) {
    long long p;
    cin >> p;
    tree[p - 1].push_back(i + 1);
  }
  cin >> x;
  function<long long(long long)> dfs = [&](long long v) {
    long long ret = 0;
    vector<vector<bool>> dp(((long long)tree[v].size()) + 1,
                            vector<bool>(5001, false));
    long long idx = 0;
    dp[0][0] = true;
    for (auto &w : tree[v]) {
      long long s = dfs(w);
      for (long long j = 0, jlen = (long long)(x[w] + 1); j < jlen; ++j) {
        if (dp[idx][j]) {
          if (j + (s - x[w]) <= x[v]) dp[idx + 1][j + (s - x[w])] = true;
          if (j + x[w] <= x[v]) dp[idx + 1][j + x[w]] = true;
        }
      }
      ret += s;
      idx++;
    }
    bool possible = false;
    long long weight = 0;
    for (long long i = (long long)(x[v]); i >= 0; --i) {
      if (dp[idx][i]) {
        possible = true;
        weight = x[v] - i;
        break;
      }
    }
    if (!possible) {
      cout << "IMPOSSIBLE"
           << "\n";
      exit(0);
    }
    return ret + weight;
  };
  dfs(0);
  cout << "POSSIBLE"
       << "\n";
  return 0;
}
