#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
struct node {
  int y, next;
} a[1010];
int len = 0, last[1010];
int f[1010], g[5010], v[5010], w[5010];
void ins(int x, int y) {
  a[++len].y = y;
  a[len].next = last[x];
  last[x] = len;
}
int n;
void dfs(int x, int fa) {
  for (int i = 1; i <= w[x]; i++) g[i] = inf;
  g[0] = 0;
  for (int i = last[x]; i; i = a[i].next) {
    int y = a[i].y;
    if (y == fa) continue;
    dfs(y, x);
    for (int i = 0; i <= w[x]; i++) v[i] = g[i], g[i] = inf;
    for (int i = 0; i <= w[x]; i++) {
      int t1 = w[y], t2 = f[y];
      if (i + t1 <= w[x]) g[i + t1] = min(g[i + t1], v[i] + t2);
      if (i + t2 <= w[x]) g[i + t2] = min(g[i + t2], v[i] + t1);
    }
  }
  int ans = inf;
  for (int i = 0; i <= w[x]; i++) ans = min(ans, g[i]);
  if (ans == inf) {
    printf("IMPOSSIBLE");
    exit(0);
  }
  f[x] = ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int fa;
    scanf("%d", &fa);
    ins(fa, i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  dfs(1, 0);
  printf("POSSIBLE");
}
