#include <bits/stdc++.h>
using namespace std;
const int Nmax = 5005, inf = 1e9;
int i, n, dad[Nmax], dp[Nmax], old[Nmax], Val[Nmax], best[Nmax];
vector<int> v[Nmax];
bool dfs(int node) {
  int i, what;
  dp[0] = 0;
  for (i = 1; i <= Val[node]; ++i) dp[i] = inf;
  for (auto son : v[node]) {
    if (!dfs(son)) return 0;
    memcpy(old, dp, sizeof(dp));
    for (i = Val[node]; i >= 0; --i) {
      dp[i] = inf;
      if (i >= best[son]) dp[i] = min(dp[i], old[i - best[son]] + Val[son]);
      if (i >= Val[son]) dp[i] = min(dp[i], old[i - Val[son]] + best[son]);
    }
  }
  best[node] = inf;
  for (i = 0; i <= Val[node]; ++i) best[node] = min(best[node], dp[i]);
  return (best[node] < 1e8);
}
int main() {
  cin >> n;
  for (i = 2; i <= n; ++i) {
    cin >> dad[i];
    v[dad[i]].push_back(i);
  }
  for (i = 1; i <= n; ++i) cin >> Val[i];
  cout << (dfs(1) ? "POSSIBLE" : "IMPOSSIBLE") << '\n';
  return 0;
}
