#include <bits/stdc++.h>
using namespace std;
int n, p[100009], x[100009], dp[1009], d[5009], prev_[5009];
vector<int> X[100009];
bool OK = false;
int dfs(int pos) {
  for (int i = 0; i < 5009; i++) {
    d[i] = (1 << 30);
    prev_[i] = (1 << 30);
  }
  prev_[0] = 0;
  for (int i = 0; i < X[pos].size(); i++) {
    int U = dfs(X[pos][i]);
    if (U == (1 << 30)) continue;
    for (int j = x[X[pos][i]]; j < 5009; j++) {
      d[j] = min(d[j], prev_[j - x[X[pos][i]]] + U);
    }
    for (int j = U; j < 5009; j++) {
      d[j] = min(d[j], prev_[j - U] + x[X[pos][i]]);
    }
    for (int j = 0; j < 5009; j++) {
      prev_[j] = d[j];
      d[j] = (1 << 30);
    }
  }
  int minx = (1 << 30);
  for (int j = 0; j <= x[pos]; j++) minx = min(minx, prev_[j]);
  dp[pos] = minx;
  if (minx >= (1 << 29)) OK = true;
  return minx;
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> p[i];
    X[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> x[i];
  dfs(1);
  if (OK == true)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
  return 0;
}
