#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using llu = long long unsigned int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
int N;
vector<vi> ch;
vi a(N);
bool ans = true;
pii dfs(int from) {
  vii b;
  int sum = 0;
  for (int to : ch[from]) {
    b.push_back(dfs(to));
  }
  vector<bool> dp(a[from] + 1, false);
  dp[0] = true;
  for (pii t : b) {
    sum += t.first + t.second;
    for (ll di = a[from] + 1 - 0 - 1; di >= 0; di--) {
      if (!dp[di]) continue;
      int ai, bi;
      ai = di + t.first;
      bi = di + t.second;
      if (ai <= a[from]) dp[ai] = true;
      if (bi <= a[from]) dp[bi] = true;
      if (ai > a[from] && bi > a[from]) ans = false;
    }
  }
  int r = 0;
  for (ll i = 0; i < a[from] + 1; i++) {
    if (dp[i]) r = i;
  }
  return {a[from], sum - r};
}
int main() {
  scanf("%d", &N);
  ch.resize(N);
  a.resize(N);
  int x;
  for (ll i = 0; i < N - 1; i++) {
    scanf("%d", &x);
    ch[--x].push_back(i + 1);
  }
  for (ll i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  dfs(0);
  printf("%sPOSSIBLE\n", ans ? "" : "IM");
  return 0;
}
