#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int f, t, nxt;
} edge[5005];
int etot = 1, head[1005];
void add_edge(int f, int t) {
  edge[++etot] = (Edge){f, t, head[f]};
  head[f] = etot;
}
int n, m, a[1005], du[1005], f[1005], g[5005];
template <typename Tp>
void read(Tp &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while ((c > '9' || c < '0')) {
    if (c == '-') {
      f = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c & 15);
    c = getchar();
  }
  x *= f;
}
int dfs(int x, int fa) {
  memset(g, 0x3f, sizeof(g));
  g[0] = 0;
  for (int i = head[x]; i; i = edge[i].nxt) {
    int y = edge[i].t;
    if (y == fa) continue;
    if (!dfs(y, x)) return 0;
    ;
    for (int j = a[x]; j >= 0; j--) {
      int tmp = 0x3f3f3f3f;
      if (j - a[y] >= 0) tmp = min(tmp, g[j - a[y]] + f[y]);
      if (j - f[y] >= 0) tmp = min(tmp, g[j - f[y]] + a[y]);
      g[j] = tmp;
    }
  }
  f[x] = 0x3f3f3f3f;
  for (int i = 0; i <= a[x]; i++) f[x] = min(f[x], g[i]);
  return f[x] != 0x3f3f3f3f;
}
int main() {
  int x;
  read(n);
  for (int i = 2; i <= n; i++) {
    read(x);
    add_edge(i, x);
    add_edge(x, i);
    du[x]++;
    du[i]++;
  }
  for (int i = 1; i <= n; i++) read(a[i]);
  puts(dfs(1, 1) ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
