#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
using VI = vector<long long>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
long long N;
VI p, x;
VVI child;
vector<P> dist;
long long dfs(long long v) {
  if (dist[v].first != -1) {
    return dist[v].first;
  }
  if (v == 0) {
    return dist[v].first = 0;
  }
  return dist[v].first = (dfs(p[v]) + 1);
}
void solve() {
  dist = vector<P>(N, {-1, 0});
  for (long long(i) = 0; (i) < (N); (i)++) {
    dist[i].second = i;
  }
  for (long long(i) = 0; (i) < (N); (i)++) {
    dfs(i);
  }
  sort(dist.begin(), dist.end(), greater<P>());
  VI y(N, 0);
  for (long long(i) = 0; (i) < (N); (i)++) {
    long long v = dist[i].second;
    VVI dp(child[v].size() + 1, VI(x[v] + 1, 0));
    dp[0][0] = 1;
    for (long long(j) = 0; (j) < (child[v].size()); (j)++) {
      for (long long(k) = 0; (k) < (x[v] + 1); (k)++) {
        if (k - x[child[v][j]] >= 0 && dp[j][k - x[child[v][j]]]) {
          dp[j + 1][k] = 1;
        }
        if (k - y[child[v][j]] >= 0 && dp[j][k - y[child[v][j]]]) {
          dp[j + 1][k] = 1;
        }
      }
    }
    long long change = -1;
    for (long long k = x[v]; k >= 0; k--) {
      if (dp[child[v].size()][k]) {
        change = k;
        break;
      }
    }
    if (change == -1) {
      cout << "IMPOSSIBLE" << endl;
      return;
    }
    long long sum = 0;
    for (long long(j) = 0; (j) < (child[v].size()); (j)++) {
      sum += x[child[v][j]];
      sum += y[child[v][j]];
    }
    y[i] = sum - change;
  }
  cout << "POSSIBLE" << endl;
}
signed main() {
  cin >> N;
  p = VI(N);
  x = VI(N);
  child = VVI(N);
  for (long long(i) = 0; (i) < (N - 1); (i)++) {
    cin >> p[i + 1];
    p[i + 1]--;
    child[p[i + 1]].push_back(i + 1);
  }
  for (long long(i) = 0; (i) < (N); (i)++) {
    cin >> x[i];
  }
  solve();
}
