#include <bits/stdc++.h>
using namespace std;
int n;
int p[1000], x[1000];
vector<int> children[1000];
pair<int, int> solve(int v) {
  if (children[v].empty()) return {0, x[v]};
  int dp[5001];
  int64_t sum = 0;
  dp[0] = 1;
  for (int u : children[v]) {
    auto p = solve(u);
    sum += p.first + p.second;
    for (int i = 0; i <= 5000; ++i) {
      if (i + p.first <= 5000)
        dp[i + p.first] = max(dp[i + p.first], dp[i] + 1);
      if (i + p.second <= 5000)
        dp[i + p.second] = max(dp[i + p.second], dp[i] + 1);
    }
  }
  for (int i = x[v] - 1; i >= 0; --i) {
    if (dp[i] == children[v].size() + 1) {
      int ret = sum - i;
      return {min(ret, x[v]), max(ret, x[v])};
    }
  }
  cout << "IMPOSSIBLE\n";
  exit(0);
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout.setf(ios_base::fixed, ios_base::floatfield);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> p[i];
    --p[i];
    children[p[i]].push_back(i);
  }
  for (int i = 0; i < n; ++i) cin >> x[i];
  solve(0);
  cout << "POSSIBLE\n";
  return 0;
}
