#include <bits/stdc++.h>
using namespace std;
int ans[10010], w[10010];
int nxt[10010 << 1], to[10010 << 1], head[10010 << 1], cnt;
void add(int u, int v) {
  nxt[++cnt] = head[u];
  to[cnt] = v;
  head[u] = cnt;
}
int g[2][10010];
void dfs(int u) {
  for (int i = head[u]; i; i = nxt[i]) dfs(to[i]);
  memset(g, 127, sizeof(g));
  int now = 0;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = to[i];
    int pre = now;
    now = !now;
    memset(g[now], 127, sizeof(g[now]));
    for (int j = 0; j <= w[u]; j++) {
      if (j >= w[v]) g[now][j] = min(g[now][j], g[pre][j - w[v]] + ans[v]);
      if (j >= ans[v]) g[now][j] = min(g[now][j], g[pre][j - ans[v]] + w[v]);
    }
  }
  for (int i = 0; i <= w[u]; i++) ans[u] = min(ans[u], g[now][i]);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int fa;
    scanf("%d", &fa);
    add(fa, i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  memset(ans, 127, sizeof(ans));
  dfs(1);
  if (ans[1] < 100000000)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
