#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static const int BS = 1 << 22;
  static unsigned char buf[BS], *st, *ed;
  if (st == ed) ed = buf + fread(st = buf, 1, BS, stdin);
  return st == ed ? EOF : *st++;
}
template <class T>
void in(T &x) {
  x = 0;
  bool f = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while ('0' <= c && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  if (f) x = -x;
}
int n;
vector<int> sn[1010];
int w[1010];
int f[1010], g[2][5010];
void dfs(int x) {
  for (register int i = 0; i < sn[x].size(); ++i) {
    dfs(sn[x][i]);
  }
  memset((g), 0x3f, sizeof(g));
  int op = 0;
  g[0][0] = 0;
  for (register int i = 0; i < sn[x].size(); ++i) {
    int v = sn[x][i];
    op ^= 1;
    memset((g[op]), 0x3f, sizeof(g[op]));
    for (register int j = 0; j <= w[x]; ++j) {
      if (j - w[v] >= 0) g[op][j] = min(g[op][j], g[op ^ 1][j - w[v]] + f[v]);
      if (j - f[v] >= 0) g[op][j] = min(g[op][j], g[op ^ 1][j - f[v]] + w[v]);
    }
  }
  for (register int i = 0; i <= w[x]; ++i) {
    f[x] = min(f[x], g[op][i]);
  }
}
signed main() {
  in(n);
  memset((f), 0x3f, sizeof(f));
  for (register int i = 2, p; i <= n; ++i) {
    in(p);
    sn[p].push_back(i);
  }
  for (register int i = 1; i <= n; ++i) {
    in(w[i]);
  }
  dfs(1);
  puts(f[1] < f[0] ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
