#include <bits/stdc++.h>
using namespace std;
void Read(int &x, char c = getchar(), bool f = 0) {
  for (x = 0; !isdigit(c); c = getchar())
    if (c == '-') f = 1;
  for (; isdigit(c); c = getchar()) x = 10 * x + c - '0';
  if (f) x = -x;
}
const int maxn = 1005, maxv = 5005, zhf = 0x3f3f3f3f;
int n, m, f[maxn], g[2][maxv], a[maxn];
int e, Begin[maxn], To[maxn * 2], Next[maxn * 2];
void add(int x, int y) {
  To[++e] = y;
  Next[e] = Begin[x];
  Begin[x] = e;
}
void dfs(int x) {
  int i, j, u;
  bool t = 0;
  memset(g, 0, sizeof g);
  for (i = Begin[x]; i; i = Next[i]) {
    u = To[i];
    dfs(u);
    t ^= 1;
    memset(g[t], 0x3f, sizeof g[t]);
    for (j = 0; j <= a[x]; j++) {
      if (j >= a[u]) g[t][j] = min(g[t][j], g[t ^ 1][j - a[u]] + f[u]);
      if (j >= f[u]) g[t][j] = min(g[t][j], g[t ^ 1][j - f[u]] + a[u]);
    }
  }
  f[x] = zhf;
  for (i = 0; i <= a[x]; i++) f[x] = min(f[x], g[t][i]);
}
int main() {
  int i, u, x;
  Read(n);
  for (i = 2; i <= n; i++) {
    Read(x);
    add(x, i);
  }
  for (i = 1; i <= n; i++) Read(a[i]);
  dfs(1);
  if (f[1] < zhf)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
