#include <bits/stdc++.h>
using namespace std;
vector<int> extra, sum;
pair<int, int> dfs(int v, int parent, vector<vector<int> >& adj,
                   vector<int>& X) {
  vector<pair<int, int> > children_vals;
  sum[v] = X[v];
  for (int i = 0; i < adj[v].size(); i++) {
    if (adj[v][i] == parent) continue;
    children_vals.push_back(dfs(adj[v][i], v, adj, X));
    sum[v] += sum[adj[v][i]];
  }
  if (children_vals.size() == 0) {
    return make_pair(X[v], 0);
  }
  for (int i = 0; i <= X[v]; i++) {
    extra[i] = 0;
  }
  extra[0] = 1;
  int poss = 0;
  for (int i = 0; i < children_vals.size(); i++) {
    int black = children_vals[i].first, white = children_vals[i].second;
    for (int j = X[v]; j >= 0; j--) {
      if (j - black >= 0 && extra[j - black] == 1) {
        extra[j] = 1;
        poss = 1;
      }
    }
  }
  if (poss) {
    return make_pair(X[v], X[v]);
  }
  return make_pair(5001, 5001);
}
int main() {
  int n;
  cin >> n;
  vector<int> parent(n + 1, 0), X(n + 1);
  vector<vector<int> > adj(n + 1);
  extra.resize(5001);
  sum.resize(n + 1, 0);
  for (int i = 2; i <= n; i++) {
    cin >> parent[i];
    adj[parent[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> X[i];
  }
  string ans = "IMPOSSIBLE";
  pair<int, int> cval = dfs(1, 0, adj, X);
  if (cval.first == X[1] || cval.second == X[1]) ans = "POSSIBLE";
  cout << ans << endl;
  return 0;
}
