#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
vector<long long> level[1000], edge[1000];
long long mx = 0;
void dfs(long long no, long long cur) {
  level[cur].push_back(no);
  mx = max(mx, cur);
  for (long long to : edge[no]) dfs(to, cur + 1);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> p(n - 1);
  for (long long i = (0); i < (n - 1); i++) cin >> p[i];
  vector<long long> x(n);
  for (long long i = (0); i < (n); i++) cin >> x[i];
  for (long long i = (0); i < (n - 1); i++) {
    p[i]--;
    edge[p[i]].push_back(i + 1);
  }
  dfs(0, 0);
  long long val[2][n];
  while (mx >= 0) {
    for (long long per : level[mx]) {
      long long sum = 0, tot = 0;
      vector<long long> dp(x[per] + 1, 0);
      dp[0] = 1;
      for (long long no : edge[per]) {
        sum += val[0][no];
        tot += val[1][no] + val[0][no];
        long long tmp = val[1][no] - val[0][no];
        for (long long i = (dp.size() + 1 - tmp - 1); i >= 0; i--)
          dp[i + tmp] += dp[i];
      }
      if (x[per] < sum) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
      }
      long long lim = 0;
      for (long long i = (0); i < (x[per] - sum + 1); i++)
        if (dp[i]) lim = i;
      tot -= sum + lim;
      val[0][per] = min(tot, x[per]);
      val[1][per] = max(tot, x[per]);
    }
    mx--;
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
