#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 5010, INF = 10000000;
int f[N][M], tot[N], b[N], ne[N], fi[N], minf[N], k, n, x;
void add(int x, int y) {
  b[++k] = y;
  ne[k] = fi[x];
  fi[x] = k;
}
void dp(int x) {
  for (int k = 0; k <= tot[x]; k++) f[x][k] = INF;
  if (!fi[x])
    f[x][tot[x]] = 0;
  else
    for (int j = fi[x]; j; j = ne[j]) {
      dp(b[j]);
      for (int k = tot[x]; k >= 1; k--) {
        if (k >= tot[b[j]])
          f[x][k] = min(f[b[j]][k - tot[b[j]]] + minf[b[j]], f[x][k]);
        if (k >= minf[b[j]])
          f[x][k] = min(f[b[j]][k - minf[b[j]]] + tot[b[j]], f[x][k]);
      }
    }
  minf[x] = f[x][0];
  for (int i = 1; i <= tot[x]; i++) minf[x] = min(minf[x], f[x][i]);
  if (minf[x] == INF) {
    puts("IMPOSSIBLE");
    exit(0);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &x);
    add(x, i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &tot[i]);
  dp(1);
  puts("POSSIBLE");
}
