#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
vector<long long> tree[1010];
long long dp[1010] = {};
long long X[1010];
bool ok = true;
void dfs(long long cur, long long par) {
  for (auto &e : tree[cur]) {
    if (e == par) continue;
    dfs(e, cur);
  }
  if (tree[cur].size() == 0) {
    dp[cur] = 0;
  } else {
    long long n = tree[cur].size();
    long long opt = INF;
    for (long long bit = (0); bit < ((1LL << n)); bit++) {
      long long v1 = 0, v2 = 0;
      for (long long i = (0); i < (n); i++) {
        long long c = tree[cur][i];
        if ((bit >> i) & 1) {
          v1 += dp[c];
          v2 += X[c];
        } else {
          v2 += dp[c];
          v1 += X[c];
        }
      }
      if (v1 <= X[cur]) {
        opt = min(opt, v2);
      }
      if (v2 <= X[cur]) {
        opt = min(opt, v1);
      }
    }
    if (opt == INF) ok = false;
    dp[cur] = opt;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  if (N > 10) return 0;
  long long P[1010];
  for (long long i = (0); i < (N - 1); i++) {
    cin >> P[i];
    P[i]--;
    tree[P[i]].push_back(i + 1);
  }
  for (long long i = (0); i < (N); i++) cin >> X[i];
  for (long long i = (0); i < (N); i++) dp[i] = INF;
  dfs(0, -1);
  if (ok) {
    cout << ("POSSIBLE") << endl;
    ;
  } else {
    cout << ("IMPOSSIBLE") << endl;
    ;
  }
}
