#include <bits/stdc++.h>
using namespace std;
struct edge {
  int k, next;
} e[2005];
int f[1005], a[1005], n, home[1005], cnt = -1;
void add(int x, int y) {
  cnt++;
  e[cnt].k = y;
  e[cnt].next = home[x];
  home[x] = cnt;
}
int g[5005], ok = 1;
void dfs(int k, int F) {
  for (int i = home[k]; ~i; i = e[i].next)
    if (e[i].k != F) {
      dfs(e[i].k, k);
    }
  memset(g, 0x3f, sizeof(g));
  g[0] = 0;
  for (int i = home[k]; ~i; i = e[i].next)
    if (e[i].k != F) {
      for (int p = a[k]; ~p; p--) {
        int x = 1e9;
        if (p >= a[e[i].k]) x = g[p - a[e[i].k]] + f[e[i].k];
        if (p >= f[e[i].k]) x = min(x, g[p - f[e[i].k]] + a[e[i].k]);
        g[p] = x;
      }
    }
  f[k] = 1e9;
  for (int i = 0; i <= a[k]; i++) f[k] = min(f[k], g[i]);
  if (f[k] > 1e8) ok = 0;
}
int main() {
  memset(home, -1, sizeof(home));
  scanf("%d", &n);
  for (int i = 2, x; i <= n; i++) {
    scanf("%d", &x);
    add(i, x);
    add(x, i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dfs(1, 0);
  if (ok)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
