#include <bits/stdc++.h>
char _;
using namespace std;
int N, first[1005], u;
long long dp1[1005], dp2[5005];
vector<int> adj[1005];
long long go2(int i, int j, int k) {
  if (adj[i].size() <= j) {
    return 0;
  }
  if (dp2[j] != -1) {
    return dp2[j];
  }
  u = adj[i][j];
  long long ret = 1 << 30;
  if (k + dp1[u] <= first[i]) {
    ret = min(ret, go2(i, j + 1, k + dp1[u]) + first[u]);
  }
  if (k + first[u] <= first[i]) {
    ret = min(ret, go2(i, j + 1, k + first[u]) + dp1[u]);
  }
  return dp2[j] = ret;
}
long long go1(int i, int p) {
  if (adj[i].empty()) {
    return dp1[i] = 0;
  }
  if (dp1[i] != -1) {
    return dp1[i];
  }
  for (int j = 0; j < adj[i].size(); j++) {
    u = adj[i][j];
    if (adj[i][j] == p) continue;
    go1(adj[i][j], i);
    for (int k = first[i]; k <= first[i]; k++) {
      if (k - first[u] >= 0) {
        dp2[k] = min(dp2[k], dp2[k - first[u]] + dp2[u]);
      }
      if (k - dp1[u] >= 0) {
        dp2[k] = min(dp2[k], dp2[k - dp1[u]] + first[u]);
      }
    }
  }
  memset(dp2, -1, sizeof dp2);
  return dp1[i] = go2(i, 0, 0);
}
int main() {
  scanf("%d", &N);
  for (int i = 2; i <= N; i++) {
    scanf("%d", &u);
    adj[u].push_back(i);
  }
  for (int i = 1; i <= N; i++) {
    scanf("%d", &first[i]);
  }
  memset(dp1, -1, sizeof dp1);
  printf("%s\n", go1(1, 1) < 1 << 30 ? "POSSIBLE" : "IMPOSSIBLE");
}
