#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
vector<vector<int> > tree;
vector<int> x;
vector<int> inv_x;
void dfs(int n = 0) {
  vector<vector<int> > dp(tree[n].size() + 1, vector<int>(x[n] + 1, inf));
  dp[0][0] = 0;
  for (int i = 0; i < tree[n].size(); ++i) {
    dfs(tree[n][i]);
    int now = x[tree[n][i]];
    for (int j = 0; j < x[n] + 1; ++j) {
      if (j >= now) {
        chmin(dp[i + 1][j], dp[i][j - now] + inv_x[tree[n][i]]);
      }
    }
    now = inv_x[tree[n][i]];
    for (int j = 0; j < x[n] + 1; ++j) {
      if (j >= now) {
        chmin(dp[i + 1][j], dp[i][j - now] + x[tree[n][i]]);
      }
    }
  }
  for (int i = 0; i < x[n] + 1; ++i) {
    chmin(inv_x[n], dp[tree[n].size()][i]);
  }
  if (inv_x[n] == inf) {
    cout << "IMPOSSIBLE" << endl;
    cout << n << endl;
    exit(0);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  tree.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    int p;
    cin >> p;
    p--;
    tree[p].push_back(i + 1);
  }
  x.resize(n);
  for (int i = 0; i < n; ++i) cin >> x[i];
  inv_x.resize(n);
  for (int i = 0; i < n; ++i) inv_x[i] = inf;
  dfs();
  cout << "POSSIBLE" << endl;
}
