#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
void fio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long double pi = 3.14159265358979323846;
vl ch[1005];
ll dp[1005];
ll a[1005];
bool poss;
const ll mx = 10000;
void dfs(ll v) {
  if (ch[v].size() == 0) {
    dp[v] = 0;
    return;
  }
  dp[v] = mx / 2 + 1;
  ll second = 0;
  bool pos[mx + 3];
  memset(pos, 0, sizeof(pos));
  bool fp = 1;
  for (ll x : ch[v]) {
    dfs(x);
    second += dp[x] + a[x];
    if (fp) {
      pos[dp[x]] = 1;
      pos[a[x]] = 1;
    } else {
      for (long long i = (mx); i >= 0; i--) {
        if (pos[i]) {
          ll ni = i + dp[x];
          if (ni <= mx + 1) pos[ni] = 1;
          ni = i + a[x];
          if (ni <= mx + 1) pos[ni] = 1;
        }
      }
    }
    fp = 0;
  }
  bool can = 0;
  for (long long i = 0; i < (mx + 1); i++) {
    if (pos[i]) {
      ll v1 = i, v2 = second - i;
      if (v1 >= 0 && v2 >= 0) {
        if (v2 <= a[v]) {
          dp[v] = min(dp[v], v1);
          can = 1;
        }
        if (v1 <= a[v]) {
          dp[v] = min(dp[v], v2);
          can = 1;
        }
      }
    }
  }
  dp[v] = min(dp[v], mx / 2 + 1);
  poss &= can;
}
void solve() {
  ll n;
  cin >> n;
  memset(dp, 0, sizeof(dp));
  for (long long i = 0; i < (n - 1); i++) {
    ll p;
    cin >> p;
    ch[--p].push_back(i + 1);
  }
  for (long long i = 0; i < (n); i++) cin >> a[i];
  poss = 1;
  dfs(0);
  if (!poss) cout << "IM";
  cout << "POSSIBLE\n";
}
int main() {
  fio();
  int T = 1;
  while (T--) solve();
}
