#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;
struct node {
  vector<int> children;
  int parent;
  int x;
  int y;
};
vector<node> nod;
stack<int> st;
void f(int ind) {
  for (int i : nod[ind].children) st.push(i);
  for (int i : nod[ind].children) f(i);
}
int main() {
  int N;
  cin >> N;
  nod.resize(N);
  for (ll i = (1); i < (N); i++) {
    int p;
    cin >> p;
    p--;
    nod[p].children.push_back(i);
    nod[i].parent = p;
  }
  for (ll i = 0; i < (N); ++i) {
    int x;
    cin >> x;
    nod[i].x = x;
    nod[i].y = 0;
  }
  st.push(0);
  f(0);
  while (!st.empty()) {
    int i = st.top();
    st.pop();
    int cn = nod[i].children.size();
    if (cn == 0) continue;
    vector<vector<bool>> dp(5001);
    dp[nod[nod[i].children[0]].x].push_back(true);
    if (nod[nod[i].children[0]].x != nod[nod[i].children[0]].y)
      dp[nod[nod[i].children[0]].y].push_back(false);
    for (ll j = (1); j < (cn); j++) {
      int x = nod[nod[i].children[j]].x;
      int y = nod[nod[i].children[j]].y;
      for (int k = 5000; k >= 0; --k) {
        if (x <= k && dp[k - x].size() == j) {
          dp[k] = dp[k - x];
          dp[k].push_back(true);
        }
        if (y <= k && dp[k - y].size() == j) {
          dp[k] = dp[k - y];
          dp[k].push_back(false);
        }
      }
    }
    int ind = -1;
    for (ll j = 0; j < (nod[i].x + 1); ++j)
      if (dp[j].size() == cn) ind = j;
    if (ind == -1) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    for (ll j = 0; j < (cn); ++j)
      nod[i].y +=
          (dp[ind][j] ? nod[nod[i].children[0]].y : nod[nod[i].children[0]].x);
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
