#include <bits/stdc++.h>
using namespace std;
int d[1001];
int dp[1001];
int tdp[1001][5001];
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int *p = new int[n];
  vector<int> *vec = new vector<int>[n];
  map<int, vector<int> > mp;
  p[0] = 0;
  for (int i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
    vec[p[i]].push_back(i);
  }
  int *x = new int[n];
  int maxi = -1;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    int current = i;
    while (current != 0) {
      d[i]++;
      current = p[current];
    }
    if (mp.find(d[i]) == mp.end()) {
      vector<int> tvec;
      tvec.push_back(i);
      mp[d[i]] = tvec;
    } else {
      mp[d[i]].push_back(i);
    }
    maxi = max(maxi, d[i]);
  }
  for (int i = maxi; i >= 0; i--) {
    if (mp[i].size() == 0) continue;
    for (auto itr = mp[i].begin(); itr != mp[i].end(); ++itr) {
      if (vec[*itr].size() == 0) {
        continue;
      }
      for (int j = 0; j <= vec[*itr].size(); j++) {
        for (int k = 0; k <= x[*itr]; k++) {
          if (k == 0) {
            if (j == 0)
              tdp[j][k] = 0;
            else {
              if (tdp[j - 1][k] != 1e9 && dp[vec[*itr][j - 1]] == 0)
                tdp[j][k] = tdp[j - 1][k] + x[vec[*itr][j - 1]];
              else
                tdp[j][k] = 1e9;
            }
          } else
            tdp[j][k] = 1e9;
        }
      }
      for (int j = 0; j < vec[*itr].size(); j++) {
        for (int k = 1; k <= x[*itr]; k++) {
          if (k >= x[vec[*itr][j]])
            tdp[j + 1][k] = min(tdp[j + 1][k],
                                tdp[j][k - x[vec[*itr][j]]] + dp[vec[*itr][j]]);
          if (k >= dp[vec[*itr][j]])
            tdp[j + 1][k] = min(tdp[j + 1][k],
                                tdp[j][k - dp[vec[*itr][j]]] + x[vec[*itr][j]]);
        }
      }
      int mini = 1e9;
      for (int j = 0; j <= x[*itr]; j++) {
        mini = min(mini, tdp[vec[*itr].size()][j]);
      }
      if (mini == 1e9) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
      }
      dp[*itr] = mini;
    }
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
