#include <bits/stdc++.h>
using namespace std;
int dfs(int v, int parent, vector<vector<int> >& adj, vector<int>& X) {
  vector<long long> dp(5010, (1e9));
  vector<long long> extra(5010, (1e9));
  dp[0] = 0;
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (u == parent) continue;
    int white = dfs(u, v, adj, X);
    if (white == (1e9)) continue;
    fill(extra.begin(), extra.end(), (1e9));
    for (int j = 0; j < 5010 - white; j++) {
      extra[j + white] = min(extra[j + white], dp[j] + X[u]);
    }
    for (int j = 0; j < 5010 - X[u]; j++) {
      extra[j + X[u]] = min(extra[j + X[u]], dp[j] + white);
    }
    swap(extra, dp);
  }
  long long min_w = (1e9);
  for (int i = 0; i <= X[v]; i++) {
    min_w = min(min_w, dp[i]);
  }
  return min_w;
}
int main() {
  int n;
  cin >> n;
  vector<int> parent(n + 1, 0), X(n + 1);
  vector<vector<int> > adj(n + 1);
  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";
  int cval = dfs(1, 0, adj, X);
  if (cval < (1e9)) ans = "POSSIBLE";
  cout << ans << endl;
  return 0;
}
