#include <bits/stdc++.h>
namespace io {
int F() {
  int n = 0, F = 1;
  char ch;
  while ((ch = getchar()) != '-' && (ch < '0' || ch > '9'))
    ;
  ch == '-' ? F = 0 : n = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9')
    n = (n << 1) + (n << 3) + ch - '0';
  return F ? n : -n;
}
long long G() {
  long long n = 0, F = 1;
  char ch;
  while ((ch = getchar()) != '-' && (ch < '0' || ch > '9'))
    ;
  ch == '-' ? F = 0 : n = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9')
    n = (n << 1) + (n << 3) + ch - '0';
  return F ? n : -n;
}
}  // namespace io
int f[1111];
int g[1111][5005];
bool la[1111][5005];
short to[1111][5005];
int fa[1111];
int x[1111];
int w[1111], co[1111];
struct edge {
  int to;
  int next;
} e[2222];
int pe = 1111;
void insert(int a, int to) {
  e[pe] = (edge){to, e[a].next};
  e[a].next = pe++;
}
int v[1111];
int siz[1111][2];
int main() {
  int n = io::F();
  for (register int i = 2; i <= n; ++i) fa[i] = io::F(), insert(fa[i], i);
  for (register int i = 1; i <= n; ++i) x[i] = io::F();
  memset(g[0], 63, sizeof(g[0]));
  for (register int i = n; i; --i) {
    g[0][0] = 0;
    memset(g[1], 63, sizeof(g[1]));
    int k = 1;
    for (register int p = e[i].next; p;
         p = e[p].next, k++, memset(g[k], 63, sizeof(g[k])))
      for (register int j = 0; j <= x[i]; ++j) {
        if (j >= x[e[p].to])
          if ((g[k][j] > (g[k - 1][j - x[e[p].to]] + f[e[p].to])
               ? g[k][j] = (g[k - 1][j - x[e[p].to]] + f[e[p].to]),
               1 : 0))
            la[k][j] = 0, to[k][j] = j - x[e[p].to];
        if (j >= f[e[p].to])
          if ((g[k][j] > (g[k - 1][j - f[e[p].to]] + x[e[p].to])
               ? g[k][j] = (g[k - 1][j - f[e[p].to]] + x[e[p].to]),
               1 : 0))
            la[k][j] = 1, to[k][j] = j - f[e[p].to];
      }
    f[i] = 0x3f3f3f3f;
    for (register int j = 0; j <= x[i]; ++j)
      if ((f[i] > (g[k - 1][j]) ? f[i] = (g[k - 1][j]), 1 : 0)) w[i] = x[i] - j;
    for (register int now = x[i] - w[i], s = k - 1; s; --s, now = to[s][now])
      v[s] = la[s][now];
    for (register int p = e[i].next, s = 1; p; p = e[p].next, ++s)
      co[e[p].to] = v[s];
    if (f[i] == 0x3f3f3f3f) {
      puts("IMPOSSIBLE");
      return 0;
    }
  }
  for (register int i = 2; i <= n; ++i) co[i] ^= co[fa[i]];
  for (register int i = n; i; --i) {
    siz[i][co[i]] += w[i];
    if (siz[i][co[i]] != x[i]) {
      puts("IMPOSSIBLE");
      return 0;
    }
    siz[fa[i]][0] += siz[i][0];
    siz[fa[i]][1] += siz[i][1];
  }
  puts("POSSIBLE");
  return 0;
}
