#include <bits/stdc++.h>
using namespace std;
int n, head[1005], cnt, a[1005], f[1005], g[2][1005], flag;
struct edge {
  int to, nxt;
} e[1005 << 1];
void adde(int x, int y) {
  e[++cnt].to = y;
  e[cnt].nxt = head[x];
  head[x] = cnt;
}
void ins(int x, int y) { adde(x, y); }
void dfs(int u) {
  if (!head[u]) {
    f[u] = 0;
    return;
  }
  for (int i = head[u], v; i; i = e[i].nxt) {
    v = e[i].to;
    dfs(v);
  }
  int nk = 0, k = 1;
  memset(g[nk], 0, sizeof(g[nk]));
  for (int i = head[u], v; i; i = e[i].nxt) {
    v = e[i].to;
    nk ^= 1, k ^= 1;
    memset(g[nk], 0x3f, sizeof(g[nk]));
    for (int j = (a[u]); j >= (0); j--) {
      if (j >= a[v]) g[nk][j] = min(g[nk][j], g[k][j - a[v]] + f[v]);
      if (j >= f[v]) g[nk][j] = min(g[nk][j], g[k][j - f[v]] + a[v]);
    }
  }
  for (int i = (0); i <= (a[u]); i++) f[u] = min(f[u], g[nk][i]);
  if (f[u] > 1000000000) flag = 0;
}
int main() {
  scanf("%d", &n);
  for (int i = (2); i <= (n); i++) {
    int x;
    scanf("%d", &x);
    ins(x, i);
  }
  for (int i = (1); i <= (n); i++) scanf("%d", &a[i]);
  memset(f, 0x3f, sizeof(f));
  flag = 1;
  dfs(1);
  puts(!flag ? "IMPOSSIBLE" : "POSSIBLE");
  return 0;
}
