#include <bits/stdc++.h>
template <typename T>
inline int cmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
const int MAXN = 1009, MAXW = 5009;
int n, w[MAXN];
struct Edge {
  int ver, nxt;
} e[MAXN << 1];
int head[MAXN], tot = 0;
inline void Add(int x, int y) {
  e[++tot].ver = y, e[tot].nxt = head[x], head[x] = tot;
}
int f[MAXN], g[MAXW];
void Dfs(int x, int fa) {
  memset(g, 0x3f, sizeof g);
  g[0] = 0;
  for (int i = head[x]; i; i = e[i].nxt) {
    int y = e[i].ver;
    if (y == fa) continue;
    Dfs(y, x);
    for (int j = w[x]; ~j; --j) {
      int trans = 0x3f3f3f3f;
      if (j >= w[y]) cmin(trans, g[j - w[y]] + f[y]);
      if (j >= f[y]) cmin(trans, g[j - f[y]] + w[y]);
      g[j] = trans;
    }
  }
  for (int i = 0; i <= w[x]; ++i) cmin(f[x], g[i]);
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    int f;
    scanf("%d", &f);
    Add(f, i), Add(i, f);
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  memset(f, 0x3f, sizeof f);
  Dfs(1, 0);
  puts(f[1] == 0x3f3f3f3f ? "IMPOSSIBLE" : "POSSIBLE");
  return 0;
}
