#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v[1000];
int vec[1000];
int dp[5001];
pair<int, int> go(int o) {
  if (v[o].empty()) return pair<int, int>(vec[o], 0);
  int flag = 0;
  int t = 0;
  vector<pair<int, int> > vv;
  for (int i = 0; i < (int)(v[o]).size(); i++) {
    vv.push_back(go(v[o][i]));
    t += vv.back().first + vv.back().second;
    flag |= (vv.back().first != 0) && (vv.back().second != 0);
  }
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  int mav = 0;
  for (int i = 0; i < (int)(vv).size(); i++) {
    for (int j = vec[o]; j >= 0; j--) {
      if (j - vv[i].first >= 0) dp[j] |= dp[j - vv[i].first];
      if (j - vv[i].second >= 0) dp[j] |= dp[j - vv[i].second];
      if (dp[j]) mav = max(mav, j);
    }
  }
  if (flag && mav == 0) {
    printf("IMPOSSIBLE");
    exit(0);
  }
  return pair<int, int>(vec[o], t - mav);
}
int main() {
  int n, t;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d", &t);
    v[--t].push_back(i);
  }
  for (int i = 0; i < n; i++) scanf("%d", &vec[i]);
  go(0);
  printf("POSSIBLE");
}
