#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];
int V[1010];
vector<int> G[1010];
bool flag;
void dfs(int v) {
  if (G[v].size() == 0) {
    V[v] = 0;
    return;
  }
  for (long long i = 0; i < G[v].size(); i++) {
    dfs(G[v][i]);
  }
  vector<int> nxt;
  for (long long i = 0; i < G[v].size(); i++) {
    nxt.push_back(V[G[v][i]]);
  }
  bitset<10000> dp;
  dp[0] = true;
  for (long long i = 0; i < nxt.size(); i++) {
    dp |= (dp << nxt[i]);
  }
  int sum = 0;
  for (long long i = 0; i < nxt.size(); i++) sum += nxt[i];
  for (int i = X[v]; i >= 0; i--) {
    if (dp[i]) {
      int here = sum - i;
      V[v] = here;
      return;
    }
  }
  flag = false;
  return;
}
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; i++) G[P[i + 2]].push_back(i + 2);
  flag = true;
  dfs(1);
  if (flag) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
