#include <bits/stdc++.h>
using namespace std;
struct edge {
  int ed, ne;
} e[1010];
int he[1010], en;
int n, sum[1010];
int g[2][5010], f[1010];
bool ans;
void ins(int a, int b) {
  e[++en].ed = b;
  e[en].ne = he[a];
  he[a] = en;
}
void dfs(int u) {
  int v, i, j, p = 0;
  for (i = he[u]; i; i = e[i].ne) dfs(e[i].ed);
  for (j = 0; j <= sum[u]; ++j) g[0][j] = 10000;
  g[0][0] = 0;
  for (i = he[u]; i; i = e[i].ne) {
    p ^= 1;
    for (j = 0; j <= sum[u]; ++j) g[p][j] = 10000;
    v = e[i].ed;
    for (j = f[v]; j <= sum[u]; ++j)
      g[p][j] = min(g[p][j], g[p ^ 1][j - f[v]] + sum[v]);
    for (j = sum[v]; j <= sum[u]; ++j)
      g[p][j] = min(g[p][j], g[p ^ 1][j - sum[v]] + f[v]);
  }
  f[u] = 10000;
  for (j = 0; j <= sum[u]; ++j) f[u] = min(f[u], g[p][j]);
  if (f[u] == 10000) ans = 1;
}
int main() {
  int i, x;
  scanf("%d", &n);
  for (i = 2; i <= n; ++i) {
    scanf("%d", &x);
    ins(x, i);
  }
  for (i = 1; i <= n; ++i) scanf("%d", &sum[i]);
  dfs(1);
  if (ans)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
