#include <bits/stdc++.h>
using namespace std;
vector<int> child[1006];
int w[1006] = {0}, b[1006] = {0};
int n, x[1006];
int f(int now) {
  int len = child[now].size();
  int dp[5006] = {0};
  int sum = 0;
  if (len == 0) {
    w[now] = x[now];
    b[now] = 0;
    return 1;
  }
  for (int i = 0; i < len; i++) {
    if (f(child[now][i]) == -1) return -1;
    sum += w[child[now][i]] + b[child[now][i]];
  }
  int t;
  for (int i = 0; i <= x[now]; i++) dp[i] = i;
  for (int i = 0; i < len; i++) {
    t = 0;
    for (int j = x[now]; j > 0; j--) {
      if (j >= w[child[now][i]]) {
        if (dp[j - w[child[now][i]]] < dp[j]) {
          t = 1;
          dp[j] = dp[j - w[child[now][i]]];
        }
      }
      if (j >= b[child[now][i]]) {
        if (dp[j - b[child[now][i]]] < dp[j]) {
          t = 1;
          dp[j] = dp[j - b[child[now][i]]];
        }
      }
    }
    if (t == 0) return -1;
  }
  w[now] = x[now];
  b[now] = sum - (x[now] - dp[x[now]]);
  return 1;
}
int main() {
  int p[1006];
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &p[i]);
    child[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  if (f(1) != -1)
    printf("POSSIBLE");
  else
    printf("IMPOSSIBLE");
  return 0;
}
