#include <bits/stdc++.h>
using namespace std;
const int Max_N = 1e4;
int N, Num, clck = 0, fa[Max_N + 10] = {}, X[Max_N + 10] = {},
            sum[Max_N + 10] = {}, f[5 * Max_N + 10] = {}, lin[Max_N + 10] = {};
struct kk {
  int Id, Next;
} e[Max_N * 2 + 10] = {};
inline void insert(int x, int y) {
  e[++Num].Next = lin[x];
  lin[x] = Num;
  e[Num].Id = y;
}
inline bool chck(int x) {
  for (int i = lin[x]; i; i = e[i].Next) {
    if (!chck(e[i].Id)) return false;
    sum[x] += sum[e[i].Id];
  }
  memset(f, 0, sizeof(f));
  f[0] = 1;
  for (int i = lin[x]; i; i = e[i].Next)
    for (int j = X[x]; j >= 0; j--) {
      f[j + X[e[i].Id]] |= f[j];
      f[j + (sum[e[i].Id] - X[e[i].Id])] |= f[j];
    }
  for (int i = X[x]; i >= 1; i--) {
    if (f[i]) {
      sum[x] += X[x] - i;
      return true;
    }
  }
  bool Flg = true;
  for (int i = lin[x]; i; i = e[i].Next)
    if (sum[e[i].Id] != X[e[i].Id]) Flg = false;
  sum[x] += X[x];
  return Flg;
}
int main() {
  scanf("%d", &N);
  for (int i = 2; i <= N; i++) {
    scanf("%d", &fa[i]);
    insert(fa[i], i);
  }
  for (int i = 1; i <= N; i++) scanf("%d", &X[i]);
  if (chck(1))
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
