#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int64_t inf64 = 1e18;
const double eps = 1e-9;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (const auto &v : vec) {
    os << v << ",";
  }
  os << "]";
  return os;
}
using i64 = int64_t;
template <class T, T op(T, T)>
class segtree {
 public:
  int n, size_;
  vector<T> dat;
  T id_;
  segtree() = default;
  segtree(int size, T id, T initial_value) { init(size, id, initial_value); }
  void init(int size, T id, T initial_value) {
    size_ = size;
    id_ = id;
    n = 1;
    while (n < size) n *= 2;
    dat.assign(2 * n - 1, id);
    for (int i = 0; i < size; ++i) update(i, initial_value);
  }
  int size() const { return size_; }
  void update(int k, T a) {
    k += n - 1;
    dat[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = op(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  T at(int index) { return dat[index + n - 1]; }
  void add(int k, T a) { update(k, at(k) + a); }
  T query(int a, int b) { return query(a, b, 0, 0, n); }
  T query(int a, int b, int k, int l, int r) {
    if (r <= a or b <= l) return id_;
    if (a <= l and r <= b) return dat[k];
    int m = (l + r) / 2;
    return op(query(a, b, k * 2 + 1, l, m), query(a, b, k * 2 + 2, m, r));
  }
};
void solve() {
  int N;
  cin >> N;
  vector<int> P(N - 1);
  vector<vector<int>> children(N);
  for (int i = (0); i < (N - 1); ++i) {
    cin >> P[i];
    --P[i];
    children[P[i]].push_back(i + 1);
  }
  vector<int> X(N);
  for (int i = (0); i < (N); ++i) cin >> X[i];
  function<bool(int, int &, int &, int)> dfs = [&](int u, int &w, int &b,
                                                   int f) {
    if (children[u].empty()) {
      if (f == 0)
        w = X[u];
      else
        b = X[u];
      return true;
    }
    for (auto v : children[u]) {
      int w_ = 0, b_ = 0, f_;
      if (w <= b)
        f_ = 1;
      else
        f_ = 0;
      if (!dfs(v, w_, b_, f)) return false;
      w += w_;
      b += b_;
    }
    int dw = X[u] - w, db = X[u] - b;
    if (dw < 0 and db < 0) return false;
    if (dw >= 0 and db < 0) {
      w = X[u];
      return true;
    }
    if (dw < 0 and db >= 0) {
      b = X[u];
      return true;
    }
    if (w <= b)
      b = X[u];
    else
      w = X[u];
    return true;
  };
  int w = 0, b = 0;
  if (dfs(0, w, b, 0))
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}
