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