#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
vector<int> e[1000];
int x[1000];
bool dp[5001];
pair<int, int> dfs(int u) {
  int i;
  for (i = 0; i <= x[u]; i++) dp[i] = false;
  dp[0] = true;
  int total = 0;
  for (auto v : e[u]) {
    auto p = dfs(v);
    for (i = x[u]; i >= 0; i--) {
      bool tmp = dp[i];
      dp[i] = false;
      if (i + p.first <= x[u]) dp[i + p.first] |= tmp;
      if (i + p.second <= x[u]) dp[i + p.second] |= tmp;
      total += p.first + p.second;
    }
  }
  for (i = x[u]; i >= 0; i--)
    if (dp[i]) {
      return {x[u], total - i};
    }
  puts("IMPOSSIBLE");
  exit(0);
}
int main(void) {
  int i, n;
  cin >> n;
  for (i = 1; i <= n - 1; i++) {
    int p;
    cin >> p;
    p--;
    e[p].push_back(i);
  }
  for (i = 0; i <= (int)(n)-1; i++) cin >> x[i];
  dfs(0);
  puts("POSSIBLE");
  return 0;
}
