#include <bits/stdc++.h>
using namespace std;
int dfs(int v, vector<vector<int>> &tree, vector<int> &X) {
  vector<int> tmp;
  if (tree[v].size() == 0) {
    return 0;
  }
  for (int u : tree[v]) {
    tmp.push_back(dfs(u, tree, X));
    if (tmp.back() == -1) return -1;
  }
  vector<int> dp(X[v] + 1, 1000000000);
  dp[X[tree[v][0]]] = tmp[0];
  dp[tmp[0]] = tmp[0];
  for (int i = 0; i < tree[v].size(); i++) {
    int u = tree[v][i];
    if (i == 0) {
      dp[X[u]] = tmp[0];
      dp[tmp[0]] = X[u];
      continue;
    }
    vector<int> next(X[v] + 1, 1000000000);
    for (int j = 0; j < X[v] + 1; j++) {
      int a = X[u];
      int b = tmp[i];
      if (j + a < X[v] + 1) {
        next[j + a] = min(next[j + a], dp[j] + b);
      }
      if (j + b < X[v] + 1) {
        next[j + b] = min(next[j + b], dp[j] + a);
      }
    }
    dp = next;
  }
  int ret = 1000000000;
  for (int i = 0; i < X[v] + 1; i++) {
    ret = min(ret, dp[i]);
  }
  if (ret == 1000000000) ret = -1;
  return ret;
}
int main() {
  int n;
  cin >> n;
  vector<vector<int>> tree(n);
  for (int i = 0; i < n - 1; i++) {
    int p;
    cin >> p;
    p--;
    tree[p].push_back(i + 1);
  }
  vector<int> X(n);
  for (int i = 0; i < n; i++) {
    cin >> X[i];
  }
  cout << (dfs(0, tree, X) >= 0 ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
