#include <bits/stdc++.h>
using namespace std;
vector<int> Ps;
vector<set<int>> Cs;
vector<int> Xs;
tuple<bool, int, int> dfs(int v) {
  if (Cs[v].empty()) {
    return make_tuple(true, Xs[v], 0);
  }
  int sum_of_children = 0;
  set<int> possible;
  for (auto c : Cs[v]) {
    auto ret = dfs(c);
    auto ok_flag = get<0>(ret);
    auto col1 = get<1>(ret);
    auto col2 = get<2>(ret);
    sum_of_children += (col1 + col2);
    if (!ok_flag) return make_tuple(false, 0, 0);
    set<int> possible2;
    for (auto p : possible) {
      possible2.insert(p + col1);
      possible2.insert(p + col2);
    }
    possible = possible2;
  }
  set<int> possible2;
  auto col2 = Xs[v];
  for (auto p : possible) {
    possible2.insert(p + col2);
    possible2.insert(p);
  }
  possible = possible2;
  sum_of_children += Xs[v];
  if (possible.count(Xs[v])) {
    return make_tuple(true, Xs[v], sum_of_children - Xs[v]);
  }
}
int main(void) {
  cin.sync_with_stdio(false);
  int N;
  cin >> N;
  Ps.resize(N);
  Cs.resize(N);
  Xs.resize(N);
  for (int n = 0; n < (int)(N - 1); ++n) {
    int c = n + 1;
    int p;
    cin >> p;
    --p;
    Ps[c] = p;
    Cs[p].insert(c);
  }
  Ps[0] = -1;
  for (int n = 0; n < (int)(N); ++n) cin >> Xs[n];
  auto ret = dfs(0);
  if (get<0>(ret)) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
