#include <bits/stdc++.h>
using namespace std;
template <class T>
using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
int N;
int P[1010];
int X[1010];
vector<int> G[1010];
int val[1010];
int rslt[1010];
void dfs(int v) {
  if (G[v].size() == 0) {
    val[v] = X[v];
    rslt[v] = X[v];
    return;
  }
  for (long long i = 0; i < G[v].size(); i++) {
    dfs(G[v][i]);
  }
  vector<int> p;
  for (long long i = 0; i < G[v].size(); i++) {
    p.push_back(val[G[v][i]]);
  }
  int sum = 0;
  bitset<100010> dp;
  dp[0] = true;
  for (long long i = 0; i < p.size(); i++) {
    dp |= (dp << p[i]);
    sum += p[i];
  }
  for (int i = X[v]; i >= 0; i--) {
    if (dp[i]) {
      if (sum - i <= X[v]) {
        val[v] = sum - i;
        rslt[v] = X[v];
        return;
      }
    }
  }
  rslt[v] = -1;
}
int main() {
  cin >> N;
  for (long long i = 0; i < N - 1; i++) cin >> P[i + 2];
  for (long long i = 0; i < N; i++) cin >> X[i + 1];
  for (long long i = 0; i < N - 1; i++) {
    G[P[i + 2]].push_back(i + 2);
  }
  dfs(1);
  bool flag = true;
  for (int i = 1; i <= N; i++) {
    if (X[i] != rslt[i]) {
      flag = false;
    }
  }
  if (flag) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
