#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<vector<int>> g(n);
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    p--;
    g[p].push_back(i);
  }
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  vector<int> res(n);
  function<void(int)> dfs = [&](int u) {
    vector<int> dp(x[u] + 1, 1 << 30);
    dp[0] = 0;
    for (auto v : g[u]) {
      dfs(v);
      vector<int> prev = dp;
      dp.assign(x[u] + 1, 1 << 30);
      int a = x[v];
      int b = res[v];
      for (int i = 0; i < prev.size(); i++)
        if (prev[i] < 1 << 30) {
          if (i + a < x[u]) dp[i + a] = min(dp[i + a], prev[i] + b);
          if (i + b < x[u]) dp[i + b] = min(dp[i + b], prev[i] + a);
        }
    }
    int mi = 1 << 30;
    for (int i = 0; i < dp.size(); i++) {
      mi = min(mi, dp[i]);
    }
    res[u] = mi;
  };
  dfs(0);
  bool ans = res[0] < 1 << 30;
  puts(ans ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
