#include <bits/stdc++.h>
using namespace std;
long long N;
long long X[1005];
vector<long long> tree[1005];
bool dp[5000005];
pair<long long, long long> dfs(long long i) {
  if ((long long)tree[i].size() == 0) return make_pair(0, X[i]);
  vector<pair<long long, long long> > vec;
  for (long long j = 0; j < (long long)tree[i].size(); j++) {
    vec.push_back(dfs(tree[i][j]));
    if (vec.back().first == -1) return make_pair(-1, -1);
  }
  vector<long long> dif;
  long long min = 0, max = 0;
  for (long long j = 0; j < (long long)vec.size(); j++) {
    min += vec[j].first;
    max += vec[j].second;
    dif.push_back(max - min);
  }
  if (X[i] < min) return make_pair(-1, -1);
  if (X[i] >= max) return make_pair(min, X[i]);
  sort(dif.begin(), dif.end());
  for (long long j = 0; j <= max; j++) dp[j] = false;
  dp[0] = true;
  for (long long k = 0; k < (long long)dif.size(); k++) {
    if (dif[k] > max) break;
    for (long long j = max; j >= 0; j--) {
      if (j - dif[k] < 0) break;
      if (dp[j - dif[k]]) dp[j] = true;
    }
  }
  for (long long j = max - X[i]; j <= max; j++) {
    if (dp[j]) {
      pair<long long, long long> ret = make_pair(min + j, X[i]);
      if (min + j > X[i]) ret = make_pair(X[i], min + j);
      return ret;
    }
  }
}
int main(void) {
  cin >> N;
  long long p;
  for (long long i = 2; i <= N; i++) {
    cin >> p;
    tree[p].push_back(i);
  }
  for (long long i = 1; i <= N; i++) cin >> X[i];
  pair<long long, long long> ans = dfs(1);
  if (ans.first == -1)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
  return 0;
}
