#include <bits/stdc++.h>
using namespace std;
struct node {
  int t, n;
} e[100005];
int head[100005], cnt = 0;
void add(int a, int b) {
  e[cnt].t = b;
  e[cnt].n = head[a];
  head[a] = cnt++;
}
int f[100005], dp[100005], c[100005], d[100005], n;
int dfs(int u) {
  int i, m, j, t;
  for (i = head[u]; ~i; i = e[i].n) {
    dfs(e[i].t);
  }
  memset(dp, 0x3f, sizeof(dp));
  dp[0] = 0;
  for (i = head[u]; ~i; i = e[i].n) {
    m = e[i].t;
    for (j = d[u]; j >= 0; j--) {
      t = 0x3f3f3f3f;
      if (j >= d[m]) {
        t = min(t, dp[j - d[m]] + f[m]);
      }
      if (j >= f[m]) {
        t = min(t, dp[j - f[m]] + d[m]);
      }
      dp[j] = t;
    }
  }
  for (i = 0; i <= d[u]; i++) {
    f[u] = min(f[u], dp[i]);
  }
}
int main() {
  int i;
  cnt = 0;
  memset(head, -1, sizeof(head));
  scanf("%d", &n);
  for (i = 2; i <= n; i++) {
    scanf("%d", &c[i]);
    add(c[i], i);
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
  }
  memset(f, 0x3f, sizeof(f));
  dfs(1);
  if (f[1] < 0x3f3f3f3f) {
    printf("POSSIBLE\n");
  } else {
    printf("IMPOSSIBLE\n");
  }
  return 0;
}
