#include <bits/stdc++.h>
using namespace std;
bool dfs(int p, const vector<vector<int>>& Cs, const vector<int>& Xs,
         vector<int>& Ys) {
  for (auto c : Cs[p]) {
    if (not dfs(c, Cs, Xs, Ys)) return false;
  }
  int cum = 0;
  int cum_min = 0;
  vector<int> dif;
  for (auto c : Cs[p]) {
    cum += Xs[c] + Ys[c];
    cum_min += min(Xs[c], Ys[c]);
    dif.push_back(abs(Xs[c] - Ys[c]));
  }
  if (cum_min > Xs[p]) return false;
  vector<bool> dp(Xs[p] + 1 - cum_min, false);
  dp[0] = true;
  for (auto d : dif)
    for (int i = Xs[p]; i >= d; --i)
      if (dp[i - d]) dp[i] = true;
  for (int i = Xs[p] - cum_min; i >= 0; --i) {
    if (dp[i]) {
      Ys[p] = cum - i - cum_min;
      return true;
    }
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<vector<int>> Cs(N, vector<int>());
  for (int i = 1; i < N; ++i) {
    int p;
    cin >> p;
    Cs[--p].push_back(i);
  }
  vector<int> Xs(N);
  for (auto& x : Xs) cin >> x;
  vector<int> Ys(N, 0);
  if (dfs(0, Cs, Xs, Ys)) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
