#include <bits/stdc++.h>
using namespace std;
struct tree {
  int p;
  vector<int> c;
  int r, x, y;
};
int N;
tree T[1005];
pair<int, int> R[1005];
void dfs(int v, int r) {
  R[v].first = r;
  R[v].second = v;
  for (auto c : T[v].c) dfs(c, r + 1);
}
int main() {
  cin >> N;
  for (int i = int(2); i < int(N + 1); ++i) {
    int p;
    cin >> p;
    T[i].p = p;
    T[p].c.push_back(i);
  }
  dfs(1, 0);
  for (int i = int(1); i < int(N + 1); ++i) {
    int x;
    cin >> x;
    T[i].x = x;
  }
  sort(R + 1, R + N + 1, greater<pair<int, int> >());
  bool U = true;
  for (int i = int(1); i < int(N + 1); ++i) {
    vector<int> dp;
    int v = R[i].second;
    int sum = 0;
    if (T[v].c.size() == 0) {
      T[v].y = 0;
      continue;
    }
    for (auto c : T[v].c) {
      int X = T[c].x;
      int Y = T[c].y;
      sum += X + Y;
      if (dp.empty()) {
        dp.push_back(X);
        dp.push_back(Y);
        continue;
      }
      int s = dp.size();
      for (int i = int(0); i < int(s); ++i) {
        if (dp[i] + X <= T[v].x) dp.push_back(dp[i] + X);
        if (dp[i] + Y <= T[v].x) dp.push_back(dp[i] + Y);
      }
      sort(dp.begin(), dp.end());
      dp.erase(unique(dp.begin(), dp.end()), dp.end());
    }
    if (dp.empty()) {
      U = false;
      break;
    }
    if (dp[0] > T[v].x) {
      U = false;
      break;
    }
    if (dp[0] == T[v].x) {
      T[v].y = sum - dp[0];
      continue;
    }
    auto it = upper_bound(dp.begin(), dp.end(), T[v].x);
    --it;
    T[v].y = sum - (*it);
  }
  if (U)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
