#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = 1 << 29;
pair<int, int> dfs(const vector<vector<int>>& childs, const vector<int>& X,
                   int now) {
  vector<pair<int, int>> cands;
  for (int child : childs[now]) cands.push_back(dfs(childs, X, child));
  if (cands.empty()) return {X[now], 0};
  const int H = cands.size();
  const int W = X[now];
  vector<vector<int>> dp(H + 1, vector<int>(W + 1, INF));
  dp[0][0] = 0;
  for (int((h)) = (0); ((h)) < ((H)); ((h))++) {
    int l, r;
    tie(l, r) = cands[h];
    for (int((w)) = (0); ((w)) < ((W)); ((w))++) {
      if (w + l <= W) dp[h + 1][w + l] = min(dp[h + 1][w + l], dp[h][w] + r);
      if (w + r <= W) dp[h + 1][w + r] = min(dp[h + 1][w + r], dp[h][w] + l);
    }
  }
  int r = *min_element(dp.back().begin(), dp.back().end());
  if (r == INF) throw 1;
  return {X[now], r};
}
int main() {
  int N;
  cin >> N;
  vector<vector<int>> childs(N);
  vector<int> X(N);
  for (int(i) = (1); (i) < (N); (i)++) {
    int p;
    cin >> p;
    p--;
    childs[p].push_back(i);
  }
  for (int((i)) = (0); ((i)) < ((N)); ((i))++) cin >> X[i];
  try {
    dfs(childs, X, 0);
    cout << "POSSIBLE" << endl;
  } catch (int str) {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
